RESOLVED FIXED 183352
AX: Implement accessible dismiss action on iOS
https://bugs.webkit.org/show_bug.cgi?id=183352
Summary AX: Implement accessible dismiss action on iOS
Nan Wang
Reported 2018-03-05 17:21:42 PST
With AOM accessibility events Spec: https://wicg.github.io/aom/spec/phase2.html we have a onaccessibledismiss event listener. Let's first support the escape action on iOS.
Attachments
patch (4.31 KB, patch)
2018-03-06 11:58 PST, Nan Wang
no flags
patch (4.48 KB, patch)
2018-03-13 02:17 PDT, chris fleizach
no flags
patch (7.75 KB, patch)
2018-03-13 02:17 PDT, chris fleizach
no flags
patch (9.16 KB, patch)
2018-03-14 00:18 PDT, chris fleizach
no flags
patch (9.21 KB, patch)
2018-03-14 08:58 PDT, chris fleizach
no flags
patch (9.58 KB, patch)
2018-03-14 09:09 PDT, chris fleizach
zalan: review+
patch for landing (9.87 KB, patch)
2018-03-14 09:24 PDT, chris fleizach
no flags
Radar WebKit Bug Importer
Comment 1 2018-03-05 17:22:23 PST
Nan Wang
Comment 2 2018-03-06 11:58:50 PST
Nan Wang
Comment 3 2018-03-06 12:01:03 PST
(In reply to Nan Wang from comment #2) > Created attachment 335123 [details] > patch Wrong bug! :(
chris fleizach
Comment 4 2018-03-13 02:17:03 PDT
chris fleizach
Comment 5 2018-03-13 02:17:53 PDT
Nan Wang
Comment 6 2018-03-13 10:49:47 PDT
Comment on attachment 335686 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=335686&action=review > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 > + return m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); I think we should somehow determine when to dispatch this event, and return YES. Otherwise the page in Safari would still back to the previous page. Maybe we dispatch the event only when there's a listener
chris fleizach
Comment 7 2018-03-13 12:08:28 PDT
Comment on attachment 335686 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=335686&action=review >> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 >> + return m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); > > I think we should somehow determine when to dispatch this event, and return YES. Otherwise the page in Safari would still back to the previous page. > Maybe we dispatch the event only when there's a listener can we just if the event Default was prevented? is that good enough?
Nan Wang
Comment 8 2018-03-13 12:14:11 PDT
Comment on attachment 335686 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=335686&action=review >>> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 >>> + return m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); >> >> I think we should somehow determine when to dispatch this event, and return YES. Otherwise the page in Safari would still back to the previous page. >> Maybe we dispatch the event only when there's a listener > > can we just if the event Default was prevented? is that good enough? It works but this event listener will only work with preventDefault. I'm not sure if it's a good practice?
Nan Wang
Comment 9 2018-03-13 12:24:33 PDT
Comment on attachment 335686 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=335686&action=review >>>> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 >>>> + return m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); >>> >>> I think we should somehow determine when to dispatch this event, and return YES. Otherwise the page in Safari would still back to the previous page. >>> Maybe we dispatch the event only when there's a listener >> >> can we just if the event Default was prevented? is that good enough? > > It works but this event listener will only work with preventDefault. I'm not sure if it's a good practice? Another concern is that there could be some generic dismiss action we implement in future (something similar to enter a 'ESC' keycode), and preventDefault is to prevent calling into that generic function. But I think currently I'm fine with either case.
chris fleizach
Comment 10 2018-03-14 00:18:54 PDT
chris fleizach
Comment 11 2018-03-14 08:51:01 PDT
> Another concern is that there could be some generic dismiss action we > implement in future (something similar to enter a 'ESC' keycode), and > preventDefault is to prevent calling into that generic function. > But I think currently I'm fine with either case. can you take a look again?
Nan Wang
Comment 12 2018-03-14 08:54:27 PDT
Comment on attachment 335765 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=335765&action=review > LayoutTests/accessibility/ios-simulator/AOM-dismiss-event.html:30 > + axNode.dismiss(); Can we also test the case when there's no event listener? Should be easy since dismiss() returns a boolean
Nan Wang
Comment 13 2018-03-14 08:56:09 PDT
Comment on attachment 335765 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=335765&action=review > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 > + m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); I think we should also call shouldDispatchAccessibilityEvent() here
Nan Wang
Comment 14 2018-03-14 08:56:48 PDT
(In reply to Nan Wang from comment #13) > Comment on attachment 335765 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=335765&action=review > > > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 > > + m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); > > I think we should also call shouldDispatchAccessibilityEvent() here nevermind, it's checked in dispatchAccessibilityEventWithType already.
chris fleizach
Comment 15 2018-03-14 08:58:39 PDT
chris fleizach
Comment 16 2018-03-14 08:59:00 PDT
(In reply to Nan Wang from comment #14) > (In reply to Nan Wang from comment #13) > > Comment on attachment 335765 [details] > > patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=335765&action=review > > > > > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 > > > + m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); > > > > I think we should also call shouldDispatchAccessibilityEvent() here > > nevermind, it's checked in dispatchAccessibilityEventWithType already. we should probably check that when returning whether this event was processed. updated patch...
Nan Wang
Comment 17 2018-03-14 09:03:24 PDT
(In reply to chris fleizach from comment #16) > (In reply to Nan Wang from comment #14) > > (In reply to Nan Wang from comment #13) > > > Comment on attachment 335765 [details] > > > patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=335765&action=review > > > > > > > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1496 > > > > + m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Dismiss); > > > > > > I think we should also call shouldDispatchAccessibilityEvent() here > > > > nevermind, it's checked in dispatchAccessibilityEventWithType already. > > we should probably check that when returning whether this event was > processed. updated patch... Yes I was about to comment on this. Can we also add a test case when there's no event listener?
chris fleizach
Comment 18 2018-03-14 09:09:51 PDT
chris fleizach
Comment 19 2018-03-14 09:10:07 PDT
> Yes I was about to comment on this. Can we also add a test case when there's > no event listener? Added
zalan
Comment 20 2018-03-14 09:15:14 PDT
Comment on attachment 335773 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=335773&action=review > Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm:74 > + for (Node* node = this->node(); node; node = node->parentNode()) { auto* should do.
chris fleizach
Comment 21 2018-03-14 09:24:59 PDT
Created attachment 335775 [details] patch for landing
WebKit Commit Bot
Comment 22 2018-03-14 10:51:15 PDT
Comment on attachment 335775 [details] patch for landing Clearing flags on attachment: 335775 Committed r229603: <https://trac.webkit.org/changeset/229603>
WebKit Commit Bot
Comment 23 2018-03-14 10:51:16 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.