Enhance accessibility of dropdown (#30928)

* fix: enhance accessibility of dropdown component by adding tabIndex and improving keyboard navigation

* test: update snapshot

* feat: use tabindex -1

* test: add tests
This commit is contained in:
Florian Duros
2025-10-01 15:26:42 +02:00
committed by GitHub
parent aa073893ab
commit 625595cb8c
4 changed files with 136 additions and 2 deletions
@@ -0,0 +1,30 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Dropdown /> renders with placeholder 1`] = `
<DocumentFragment>
<div
class="mx_Dropdown"
>
<div
aria-describedby="id_value"
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Test Dropdown"
aria-owns="id_input"
class="mx_AccessibleButton mx_Dropdown_input mx_no_textinput"
role="button"
tabindex="0"
>
<div
class="mx_Dropdown_option"
id="id_value"
>
Select an option
</div>
<span
class="mx_Dropdown_arrow"
/>
</div>
</div>
</DocumentFragment>
`;
@@ -11,6 +11,7 @@ exports[`<FilterDropdown /> renders dropdown options in menu 1`] = `
class="mx_Dropdown_option mx_Dropdown_option_highlight"
id="test__one"
role="option"
tabindex="-1"
>
<div
class="mx_FilterDropdown_option"
@@ -40,6 +41,7 @@ exports[`<FilterDropdown /> renders dropdown options in menu 1`] = `
class="mx_Dropdown_option"
id="test__two"
role="option"
tabindex="-1"
>
<div
class="mx_FilterDropdown_option"