fix(ui5-file-uploder): match focus correctly with screen readers #10700
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.
Previously, when using screen reader with
ui5-file-uploader
with attributehide-input
set totrue
, the checkthis.getFocusDomRef().matches(":has(:focus-within)")
on our_onclick()
event handler was falsy when the component was being focused with screen reader ON, preventing theclick
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 theclick
event as expected even with screen reader ON.Tested with JAWS.
Fixes: #10656