Fix: block manager scrollable UI a11y fix #68800
Open
+59
−0
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.
Closes #67959
What?
Fixes an issue where focused elements in scrollable lists with sticky headers or footers can remain hidden behind those elements when navigating using a keyboard or keyboard-like devices.
Why?
Sticky headers and footers are commonly used in the UI to keep certain elements fixed while scrolling.
How?
Block Manager Issue
The issue is resolved by dynamically adjusting the scroll position of the container based on the position of sticky elements and the currently focused element. Here's how it was implemented:
Identify Key Elements:
document.querySelector
to target the relevant modal or scrollable content.querySelectorAll
.Focus Handling:
focusin
events, which are triggered whenever an element inside the container gains focus.getActiveStickyElement
, determines the currently active sticky element based on its position relative to the scrollable container.Scroll Adjustment Logic:
scrollTo
with thesmooth
behavior for a better user experience.Event Listener Cleanup:
useEffect
hook to avoid memory leaks or unintended behavior when the component unmounts.Testing Instructions
Testing Instructions for Keyboard
Preferences Modal Dialog:
Open the Preferences Modal Dialog > Blocks.
Ensure the list of blocks is long enough to make the panel scrollable.
Use the Tab key to navigate and then Shift+Tab to navigate backwards.
Confirm that focused elements remain visible during navigation.
Test across different browsers (e.g., Chrome, Safari, Firefox) to ensure consistent behavior.
Screenshots or screencast
Screen.Recording.2025-01-17.at.9.47.58.PM.mov