Skip to content

Commit f9cec07

Browse files
committed
Fix e2e test failure in accessibility check by making sure empty img tag has role=presentation
1 parent 5422699 commit f9cec07

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cypress/e2e/metadata-xss-sanitization.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
describe('Metadata XSS sanitization', () => {
1313
// A classic XSS payload: an image with a broken `src` so that its `onerror` handler fires as soon as
1414
// the browser tries (and fails) to load it. If the payload is not sanitized, `onerror` will run and set
15-
// `window.dsXssExecuted = true`.
16-
const XSS_PAYLOAD = 'XSS Test <img src="x" onerror="window.dsXssExecuted = true;"/>';
15+
// `window.dsXssExecuted = true`. (NOTE: This uses "role=presentation" to avoid failing accessibility checks)
16+
const XSS_PAYLOAD = 'XSS Test <img src="x" onerror="window.dsXssExecuted = true;" role="presentation"/>';
1717
const SAFE_TEXT = 'XSS Test';
1818
const UNIQUE_TITLE = `XSS sanitization test item ${Date.now()}`;
1919

0 commit comments

Comments
 (0)