Bug 246580 - AX: WebKit does not break AX modality when focus is explicitly moved outside the modal
Summary: AX: WebKit does not break AX modality when focus is explicitly moved outside ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-10-15 13:29 PDT by Tyler Wilcock
Modified: 2022-10-17 21:48 PDT (History)
10 users (show)

See Also:


Attachments
Patch (6.62 KB, patch)
2022-10-15 13:33 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (6.56 KB, patch)
2022-10-15 13:34 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (8.69 KB, patch)
2022-10-17 12:23 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Wilcock 2022-10-15 13:29:45 PDT
https://www.w3.org/TR/wai-aria-1.1/#aria-modal

"If focus moves to an element outside the modal element, assistive technologies SHOULD NOT limit navigation to the modal element."

We don't follow this recommendation, and we should.
Comment 1 Radar WebKit Bug Importer 2022-10-15 13:29:55 PDT
<rdar://problem/101209793>
Comment 2 Tyler Wilcock 2022-10-15 13:33:58 PDT
Created attachment 463012 [details]
Patch
Comment 3 Tyler Wilcock 2022-10-15 13:34:46 PDT
Created attachment 463013 [details]
Patch
Comment 4 chris fleizach 2022-10-16 21:56:17 PDT
Comment on attachment 463013 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=463013&action=review

> Source/WebCore/accessibility/AXObjectCache.h:515
> +    enum class WillRecomputeFocus : bool { No, Yes };

"RecomputeFocus" seems like might be enough

> Source/WebCore/accessibility/AXObjectCache.h:517
> +    Element* updateCurrentModalNodeInternal(WillRecomputeFocus = WillRecomputeFocus::No);

both of these are private methods. can they be combined? or renamed to be more specific?
Comment 5 Tyler Wilcock 2022-10-17 12:23:28 PDT
Created attachment 463039 [details]
Patch
Comment 6 Tyler Wilcock 2022-10-17 12:24:11 PDT
(In reply to chris fleizach from comment #4)
> Comment on attachment 463013 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=463013&action=review
> 
> > Source/WebCore/accessibility/AXObjectCache.h:515
> > +    enum class WillRecomputeFocus : bool { No, Yes };
> 
> "RecomputeFocus" seems like might be enough
I chose "WillRecomputeFocus" here because updateCurrentModalNodeInternal needs to know if the calling code knows we will recompute the focus through some other means (e.g. via our modal auto-focusing mechanism). It needs to know this because if the calling context will not recompute focus, and the focused element is outside our modals, we must invalidate modality per-spec.

I feel like "RecomputeFocus" doesn't capture this intent the same way "WillRecomputeFocus" does, but if you feel strongly about RecomputeFocus or some other alternative I'd be willing to make the change.

> > Source/WebCore/accessibility/AXObjectCache.h:517
> > +    Element* updateCurrentModalNodeInternal(WillRecomputeFocus = WillRecomputeFocus::No);
> 
> both of these are private methods. can they be combined? or renamed to be
> more specific?
Fixed by inlining updateCurrentModalNodeInternal into a lambda within updateCurrentModalNode.
Comment 7 EWS 2022-10-17 21:48:20 PDT
Committed 255665@main (b6eab27a3f8d): <https://commits.webkit.org/255665@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 463039 [details].