Problem/Motivation
The header pattern handles modals for mobile search and menu.
These modals have currently some accessibility issues :
- the search modal doesn't have an accessible name (necessary for assistive technologies like screen readers)
- the "open" button for the menu has an erroneous aria-haspopup="menu" : this attribute is not mandatory, but if present, it should be "dialog" (a "menu" here doesn't mean a website navigation, but more like a native application menu, which is not our case)
- the "close" buttons have the same text/title, which makes them not explicit enough (and also the title attribute should be used only to complement the button text, it has no use if it's a simple repeat)
Steps to reproduce
Populate the header pattern with a search bar.
On a small window or mobile phone, navigate the header with a screenreader, or "inspect accessibility properties".
Open the search modal : it says only "dialog" (contrary to the menu modal which says "menu"), its accessible name is "null".
Tabulate to the close button : it says only "close", its accessible name is "close", as is its inside text.
The problem is the same for the close button in the menu modal.
Proposed resolution
Add an id attribute on the opening button of the search modal, and an aria-labelledby attribute on the search modal to point on that id, so that the button text ("Search") is use as the modal name (same technique used currently for the menu modal).
Modify/add the aria-haspopup attribute on the "open" buttons so that it indicates "dialog", or delete it.
Modify the title attributes on the "close" buttons so that they have each their own, and complement their inside text : "Close search" and "Close menu".
Issue fork ui_suite_dsfr-3381866
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mh_nichtsComment #4
mh_nichtsI've made a proposal.
For the aria-haspopup attribute, I just changed it to "dialog" : I didn't delete it, and I didn't add one on the search "open" button, to stay closest to the DSFR documentation (https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/en...). Nevertheless we will open an issue on the DSFR side to fix their code.
Comment #5
mh_nichtsComment #6
pdureau commentedi will have a look
Comment #7
mh_nichtsIssue créée côté DSFR pour aria-haspopup : https://github.com/GouvernementFR/dsfr/issues/744
Comment #8
pdureau commentedHi,
You have added
id="fr-btn-search-mobile"and movedid="fr-btn-menu-mobile"Is it safe to have such hardcoded ID? What may happen if we have many header component in the page?
(it is a real question, not a rhetorical one)
If hardcoding those ID is an issue, you can introduce a new
header_idstring prop ("textfield setting") then (non-tested non-authoritative proposal):What do you think?
PS: There are also search_mid & mobile_menu_mid which may be problematic but they don't come from your MR and will be fixed in #3380233: [beta4] Always use default() filter with random function()
Comment #9
pdureau commentedComment #10
mh_nichtsSorry about all the separate pushes, but MR should be OK now :)
Comment #11
mh_nichtsComment #12
pdureau commentedheader_id was added but not defined in templates/patterns/header/header.ui_patterns.yml
Comment #13
mh_nichtsComment #15
pdureau commentedThanks
Comment #16
pdureau commented