Commit dec4f24c authored by Robert Knight's avatar Robert Knight

Add accessible name to "Export formats" dropdown

The space for the export format select is limited so we rely on a combination of
the value and the descriptions in the dropdown content to indicate what it is
for. axe-core doesn't understand this though, so add an accessible label as
well.

In the process remove an accessibility violation suppression for the user
dropdown, as that violation is no longer reported.
parent 25c14216
......@@ -323,6 +323,7 @@ function ExportAnnotations({
/>
<div className="grow-0 ml-2 min-w-[5rem]">
<Select
aria-label="Export format"
value={exportFormat}
onChange={setExportFormat}
buttonContent={exportFormat.shortTitle ?? exportFormat.title}
......
......@@ -594,26 +594,8 @@ describe('ExportAnnotations', () => {
it('should pass a11y checks', async () => {
const wrapper = createComponent();
const select = await waitForSelect(wrapper, 'user-select');
await checkAccessibility({
content: () => wrapper,
shouldIgnoreViolation: ({ id, nodes }) => {
if (id !== 'button-name') {
return false;
}
// axe-core can report a violation on any button[role="combobox"] linked
// to a label if it does not have aria-label or aria-labelledby, because
// the Dragon NaturallySpeaking screen reader does not play well with
// that combination.
// Since its use is marginal, we want to ignore the "button-name"
// violation if reported on SelectNext.
// See https://github.com/dequelabs/axe-core/issues/4235 for context
const targets = nodes.flatMap(node => node.target);
return targets.includes(`#${select.prop('buttonId')}`);
},
})();
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment