Open CJE001 opened 1 month ago
2.4.7 Focus Visible WCAG 2.0 Level AA
Any keyboard operable user interface has a mode of operation where the keyboard focus indicator is visible.
Users who rely on the keyboard to navigate and interact with websites significantly benefit from being able to identify what component has keyboard focus. Providing a visible focus indicator ensures sighted users are able to determine which component is currently focused.
Summary
Via Vision Australia assessment: August 2024
Impact: medium
Note: DTA have a 90 day remediation period to address the identified issues within the audit, all issues must be resolved to obtain WCAG 2.2 certification for digital.gov.au.
Steps to reproduce
Global issue – Left side navigation Digital Experience | digital.gov.au (https://www.digital.gov.au/policy/digital-experience)
Observed outcome
When navigating via keyboard, collapsing the sub-navigation lists in the side navigation results in the focused element and its focus indicator not being visible. This is due to the content being reduced to a height of 0 in the CSS when the link to expand or collapse the sub-navigation is activated.
Sub-navigation trigger link
When sub-navigation collapsed, focus remains on the now visually hidden trigger link
Code used
HTML
CSS
Why this matters
When a focused element is not visible, or does not have highly visible focus indicator, sighted keyboard users may have difficulty determining what element has keyboard focus. They may have trouble activating controls or interacting with the content.
Expected outcome
When a user activates the link to collapse the sub-navigation, hide the list that it controls the visibility of using the CSS display:none; property.
The triggering link should remain visible and retain keyboard focus. This property should be updated to display:block; when a user reactivates the link to expand the sub-navigation.
The tabindex attribute can be removed from the links. When content is hidden via the CSS display:none; property it will be hidden from all users and not appear in the keyboard focus order.
Code example
Related issues
For other issues related to this component, please refer to:
• Issue 10 – Current page shown with presentation alone • Issue 22 – Sub-navigation links not keyboard accessible • Issue 23 – Illogical focus order when skip link activated • Issue 24 – Hidden navigation elements in keyboard focus order • Issue 33 – Element with aria-hidden attribute contains focusable descendants • Issue 36 – Link has invalid state