This document is used as aria/accessibility(a11y) reference for future developers.
There are a lot of a11y problems in the Fomantic UI library. Files in
web_src/js/modules/fomantic/ are used as a workaround to make the UI more accessible.
The aria-related code is designed to avoid touching the official Fomantic UI library, and to be as independent as possible, so it can be easily modified/removed in the future.
To test the aria/accessibility with screen readers, developers can use the following steps:
Command + F5 to turn on VoiceOver.The ideal checkboxes should be:
<label><input type="checkbox"> ... </label>
However, the templates still have the Fomantic-style HTML layout:
<div class="ui checkbox">
<input type="checkbox">
<label>...</label>
</div>
We call initAriaCheckboxPatch to link the input and label which makes clicking the
label etc. work. There is still a problem: These checkboxes are not friendly to screen readers,
so we add IDs to all the Fomantic UI checkboxes automatically by JS. If the label part is empty,
then the checkbox needs to get the aria-label attribute manually.
Fomantic Dropdown is designed to be used for many purposes:
<select> , used in many formsFomantic Dropdown requires that the focus must be on its primary element. If the focus changes, it hides or panics.
At the moment, the aria-related code only tries to partially resolve the a11y problems for dropdowns with items.
There are different solutions:
The current approach is: detect if the dropdown has an input, if yes, it works like a combobox, otherwise it works like a menu. Multiple selection dropdown is not well-supported yet, it needs more work.
Some important pages for dropdown testing:
<!-- read-only dropdown -->
<div class="ui dropdown"> <!-- focused here, then it's not perfect to use aria-activedescendant to point to the menu item -->
<input type="hidden" ...>
<div class="text">Default</div>
<div class="menu" tabindex="-1"> <!-- "transition hidden|visible" classes will be added by $.dropdown() and when the dropdown is working -->
<div class="item active selected">Default</div>
<div class="item">...</div>
</div>
</div>
<!-- search input dropdown -->
<div class="ui dropdown">
<input type="hidden" ...>
<input class="search" autocomplete="off" tabindex="0"> <!-- focused here -->
<div class="text"></div>
<div class="menu" tabindex="-1"> <!-- "transition hidden|visible" classes will be added by $.dropdown() and when the dropdown is working -->
<div class="item selected">...</div>
<div class="item">...</div>
</div>
</div>