Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,15 @@ export class Toolbar {
.replace(/\son\w+\s*=\s*["'][^"']*["']/gi, '')
.replace(/\son\w+\s*=\s*[^\s>]*/gi, '');

return cleaned;
const template = document.createElement('template');
template.innerHTML = cleaned;

template.content.querySelectorAll('svg').forEach(icon => {
icon.setAttribute('aria-hidden', 'true');
icon.setAttribute('focusable', 'false');
});

return template.innerHTML;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions test/toolbar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ console.log('━'.repeat(50));
'Toolbar item semantics',
'Expected toggle state only on toggle buttons and separators outside tab order'
);
assert(
Array.from(toolbar.querySelectorAll('.overtype-toolbar-button svg')).every(icon =>
icon.getAttribute('aria-hidden') === 'true' && icon.getAttribute('focusable') === 'false'
),
'Toolbar icons are decorative',
'Expected every toolbar SVG icon to be hidden from assistive technology and removed from SVG focus'
);

editor.destroy();
})();
Expand Down