Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-file-uploder): match focus correctly with screen readers #10700

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hinzzx
Copy link
Contributor

@hinzzx hinzzx commented Jan 29, 2025

Previously, when using screen reader with ui5-file-uploader with attribute hide-input set to true, the check
this.getFocusDomRef().matches(":has(:focus-within)") on our _onclick() event handler was falsy when the component was being focused with screen reader ON, preventing the click event from happening.

The reason may be that with the screen reader on, focus is most likely landing on the parent element itself (not on a child), which breaks the :has(:focus-within) check.

The :has(:focus-within) checks - "does this element contain at least one child that is :focus-within", which excludes the parent itself causing the check to be falsy in those scenarios.

With this change, the element.matches(":focus-within") checks -"Is this element or any of its children focused?" which fixes the problem, and checks correctly which is the focused item, triggering the click event as expected even with screen reader ON.

Tested with JAWS.

Fixes: #10656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants