Bug 213875

Summary: AX: Implement user action spec for Escape action
Product: WebKit Reporter: chris fleizach <cfleizach>
Component: AccessibilityAssignee: chris fleizach <cfleizach>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, darin, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
patch
none
patch
none
patch
none
patch
none
patch
darin: review+
patch
none
patch
none
patch
none
Patch
none
patch none

Description chris fleizach 2020-07-02 00:43:27 PDT
User action events from Assistive Technology

To preserve the privacy of assistive technology users, events from assistive technology will typically cause a synthesised DOM event to be triggered. The events are determined by platform conventions and partially documented in the ARIA Authoring Practices Guide (APG).

dismiss or escape	all elements		Escape KeyboardEvent

https://github.com/WICG/aom/blob/gh-pages/explainer.md#user-action-events-from-assistive-technology
Comment 1 Radar WebKit Bug Importer 2020-07-02 00:43:35 PDT
<rdar://problem/65022980>
Comment 2 chris fleizach 2020-07-02 00:46:56 PDT
Created attachment 403350 [details]
Patch
Comment 3 chris fleizach 2020-07-02 01:15:54 PDT
Created attachment 403352 [details]
patch
Comment 4 chris fleizach 2020-07-02 09:37:53 PDT
Created attachment 403373 [details]
patch
Comment 5 chris fleizach 2020-07-02 13:28:10 PDT
Created attachment 403393 [details]
patch
Comment 6 chris fleizach 2020-07-02 15:07:14 PDT
Created attachment 403402 [details]
patch
Comment 7 chris fleizach 2020-07-02 23:51:13 PDT
Created attachment 403442 [details]
patch
Comment 8 Darin Adler 2020-07-05 13:33:15 PDT
Comment on attachment 403442 [details]
patch

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

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1100
> +    // In case the keyboard event causes this element to be removed.
> +    Ref<AccessibilityObject> protectedThis(*this);

This should be moved int dispatchSimulatedKeyboardUpDownEvent; that’s where the protection is needed, not here.

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1110
> +bool AccessibilityNodeObject::dispatchSimulatedKeyboardUpDownEvent(KeyboardEvent::Init& keyInit)

Should take a const&

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1132
>      Ref<AccessibilityObject> protectedThis(*this);

Can move this into dispatchSimulatedKeyboardUpDownEvent and remove it here.

> Source/WebCore/accessibility/AccessibilityNodeObject.h:32
> +#include "KeyboardEvent.h"

This dependency is really unfortunate, but I suppose there’s no way to forward declare something from inside a base class?

> Source/WebCore/accessibility/AccessibilityNodeObject.h:195
> +    bool performEscape() override;

final instead of override

> Source/WebCore/accessibility/AccessibilityNodeObject.h:196
> +    bool dispatchSimulatedKeyboardUpDownEvent(KeyboardEvent::Init&);

Argument should be const&, not non-const&.

> Source/WebCore/accessibility/AccessibilityObject.h:481
> +    bool performEscape() override { return false; }

final instead of override

> Source/WebCore/accessibility/AccessibilityObjectInterface.h:910
> +    virtual bool performEscape() = 0;

Seems like more of this should be named performDismissAction, and not use the word "escape".
Comment 9 chris fleizach 2020-07-06 12:34:41 PDT
(In reply to Darin Adler from comment #8)
> Comment on attachment 403442 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=403442&action=review
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1100
> > +    // In case the keyboard event causes this element to be removed.
> > +    Ref<AccessibilityObject> protectedThis(*this);
> 
> This should be moved int dispatchSimulatedKeyboardUpDownEvent; that’s where
> the protection is needed, not here.
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1110
> > +bool AccessibilityNodeObject::dispatchSimulatedKeyboardUpDownEvent(KeyboardEvent::Init& keyInit)
> 
> Should take a const&
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1132
> >      Ref<AccessibilityObject> protectedThis(*this);
> 
> Can move this into dispatchSimulatedKeyboardUpDownEvent and remove it here.
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.h:32
> > +#include "KeyboardEvent.h"

I think I can make this a static function inside the .cpp file so it doesn't have to be in the header

> 
> This dependency is really unfortunate, but I suppose there’s no way to
> forward declare something from inside a base class?
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.h:195
> > +    bool performEscape() override;
> 
> final instead of override
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.h:196
> > +    bool dispatchSimulatedKeyboardUpDownEvent(KeyboardEvent::Init&);
> 
> Argument should be const&, not non-const&.
> 
> > Source/WebCore/accessibility/AccessibilityObject.h:481
> > +    bool performEscape() override { return false; }
> 
> final instead of override
> 
> > Source/WebCore/accessibility/AccessibilityObjectInterface.h:910
> > +    virtual bool performEscape() = 0;
> 
> Seems like more of this should be named performDismissAction, and not use
> the word "escape".
Comment 10 chris fleizach 2020-07-06 13:04:11 PDT
Created attachment 403609 [details]
patch
Comment 11 chris fleizach 2020-07-06 13:05:07 PDT
Created attachment 403610 [details]
patch
Comment 12 Darin Adler 2020-07-06 13:19:36 PDT
Comment on attachment 403610 [details]
patch

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

> Source/WebCore/accessibility/AccessibilityObjectInterface.h:910
> +    virtual bool performDismissAction() { return false; };

No need for the trailing semicolon here.
Comment 13 chris fleizach 2020-07-06 13:23:01 PDT
Created attachment 403615 [details]
patch

thanks!
Comment 14 chris fleizach 2020-07-06 14:45:51 PDT
Created attachment 403623 [details]
Patch
Comment 15 chris fleizach 2020-07-06 14:56:55 PDT
Created attachment 403625 [details]
patch
Comment 16 EWS 2020-07-06 17:09:21 PDT
Committed r264000: <https://trac.webkit.org/changeset/264000>

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