fix(FocusTrap): resolve aria_hidden_nontabbable accessibility violation #8470
+1
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #8365
The Issue
The focus guard elements (the hidden spans used to trap focus) were rendered with conflicting attributes: tabIndex="0" combined with aria-hidden="true" and role="presentation".
Reason
A focusable element (tabIndex="0") cannot be marked as hidden (aria-hidden="true") because it creates a state where focus lands on an element that technically "doesn't exist" in the accessibility tree.
The Fix
I have removed aria-hidden={true} and role={'presentation'} from the createFocusableElement helper.
These elements are technically focusable, so they must be exposed to the accessibility tree.
They remain visually hidden via the existing p-hidden-accessible CSS class.
The onFocus event handlers continue to function correctly, redirecting focus instantly without negatively impacting screen reader announcements.
How Has This Been Tested?
Automated Scan: Verified that the aria_hidden_nontabbable (Fail_1) error no longer appears in accessibility scans.
Functional Test: Verified that the focus trap still functions correctly (Focus loops back to the start when tabbing past the last element, and vice versa).
Visual Test: Confirmed no visual regression (the spans remain invisible).