RESOLVED FIXED Bug 203798
AX: WKWebView does not shift Accessibility Focus for Catalyst
https://bugs.webkit.org/show_bug.cgi?id=203798
Summary AX: WKWebView does not shift Accessibility Focus for Catalyst
Eric Liang
Reported 2019-11-03 16:45:17 PST
WKWebViews do not respond to JavaScript that tell them to `focus()`, changing the Accessibility Element selected. Steps To Reproduce: 1. Enable VoiceOver 2. Open a webpage that auto-shifts Accessibility focus via JavaScript. 3. Verify that no shift occurs. (See Notes section for a working sample and instructions) Results: The WKWebView should adjust its Accessibility focus, but does not. Regression: This feature works great on iPad, just not in Catalyst. Notes: 1. Download simpleCommands.zip containing HTML, CSS, and JS files. 2. Enable VoiceOver 3. Open simpleCommands.html inside Safari. After 5 seconds, the focus should switch and VoiceOver should begin reading out ‘today’s date’. 4. Now open the project found in WebpageCutscene.zip. It uses the same webpage as before. 5. Build and Run this project targeting Mac Catalyst. You will see that the VoiceOver focus does not shift when ran inside an app.
Attachments
Patch (3.63 KB, patch)
2019-11-03 17:21 PST, Eric Liang
no flags
Patch (11.97 KB, patch)
2019-11-04 12:17 PST, Eric Liang
no flags
Patch (11.97 KB, patch)
2019-11-04 14:17 PST, Eric Liang
no flags
Patch (20.49 KB, patch)
2019-11-04 16:31 PST, Eric Liang
no flags
Patch (24.37 KB, patch)
2019-11-06 17:56 PST, Eric Liang
no flags
Patch (1.46 KB, patch)
2019-11-08 10:54 PST, Per Arne Vollan
no flags
Radar WebKit Bug Importer
Comment 1 2019-11-03 16:45:27 PST
Eric Liang
Comment 2 2019-11-03 17:21:08 PST
chris fleizach
Comment 3 2019-11-03 18:13:03 PST
Comment on attachment 382712 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382712&action=review > Source/WebKit/UIProcess/ios/WKContentView.mm:578 > + [self _updateRemoteAccessibilityRegistration:NO]; there are a number of places to cleanup. check the other places where we do accessibility cleanup
chris fleizach
Comment 4 2019-11-03 18:13:49 PST
You should also get a WebKit2 contributors point of view, like Daniel Bates or Brent Fulgham
Eric Liang
Comment 5 2019-11-03 23:34:09 PST
(In reply to chris fleizach from comment #3) > Comment on attachment 382712 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=382712&action=review > > > Source/WebKit/UIProcess/ios/WKContentView.mm:578 > > + [self _updateRemoteAccessibilityRegistration:NO]; > > there are a number of places to cleanup. check the other places where we do > accessibility cleanup Even though we do more cleanups in other places, if the process identifier didn't change, do we need to unregister the pid for ax?
Eric Liang
Comment 6 2019-11-03 23:35:34 PST
(In reply to chris fleizach from comment #3) > Comment on attachment 382712 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=382712&action=review > > > Source/WebKit/UIProcess/ios/WKContentView.mm:578 > > + [self _updateRemoteAccessibilityRegistration:NO]; > > there are a number of places to cleanup. check the other places where we do > accessibility cleanup the Mac version cleans up when 1) page closed, 2) process swaps or exits
chris fleizach
Comment 7 2019-11-04 02:45:00 PST
Comment on attachment 382712 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382712&action=review >>>> Source/WebKit/UIProcess/ios/WKContentView.mm:578 >>>> + [self _updateRemoteAccessibilityRegistration:NO]; >>> >>> there are a number of places to cleanup. check the other places where we do accessibility cleanup >> >> Even though we do more cleanups in other places, if the process identifier didn't change, do we need to unregister the pid for ax? > > the Mac version cleans up when 1) page closed, 2) process swaps or exits ok I think that's right
Tim Horton
Comment 8 2019-11-04 11:15:06 PST
Comment on attachment 382712 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382712&action=review > Source/WebKit/UIProcess/ios/WKContentView.mm:73 > +SOFT_LINK_FRAMEWORK(AppKit) > +SOFT_LINK_CLASS(AppKit, NSAccessibilityRemoteUIElement) Why are you softlinking AppKit? WebKit links AppKit directly. > Source/WebKit/UIProcess/ios/WKContentView.mm:79 > +@interface NSObject(NSAccessibilityRemoteUIElement_Private) > +- (void)registerRemoteUIProcessIdentifier:(pid_t)pid; > +- (void)unregisterRemoteUIProcessIdentifier:(pid_t)pid; > +@end > +#endif This should be in a SPI header, not here.
Eric Liang
Comment 9 2019-11-04 11:19:32 PST
Comment on attachment 382712 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382712&action=review >> Source/WebKit/UIProcess/ios/WKContentView.mm:73 >> +SOFT_LINK_CLASS(AppKit, NSAccessibilityRemoteUIElement) > > Why are you softlinking AppKit? WebKit links AppKit directly. Correct me if I'm wrong, but this is the iOS code so I don't think we can link or import anything from AppKit because of unavailability build errors.
Tim Horton
Comment 10 2019-11-04 11:21:01 PST
(In reply to Eric Liang from comment #9) > Comment on attachment 382712 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=382712&action=review > > >> Source/WebKit/UIProcess/ios/WKContentView.mm:73 > >> +SOFT_LINK_CLASS(AppKit, NSAccessibilityRemoteUIElement) > > > > Why are you softlinking AppKit? WebKit links AppKit directly. > > Correct me if I'm wrong, but this is the iOS code so I don't think we can > link or import anything from AppKit because of unavailability build errors. Oh, macCatalyst might not link AppKit directly, that's a fair point. In that case, you should have -Softlinking headers like other frameworks.
Eric Liang
Comment 11 2019-11-04 12:17:15 PST
chris fleizach
Comment 12 2019-11-04 14:13:59 PST
Comment on attachment 382757 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382757&action=review > Source/WebKit/UIProcess/ios/AppKitSoftLink.h:2 > + * Copyright (C) 2018 Apple Inc. All rights reserved. 2019 > Source/WebKit/UIProcess/ios/AppKitSoftLink.mm:2 > + * Copyright (C) 2018 Apple Inc. All rights reserved. 2019
Eric Liang
Comment 13 2019-11-04 14:17:48 PST
Tim Horton
Comment 14 2019-11-04 14:46:37 PST
Comment on attachment 382774 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382774&action=review > Source/WebKit/UIProcess/ios/AppKitSoftLink.h:38 > +@interface NSObject(NSAccessibilityRemoteUIElement_Private) > +- (void)registerRemoteUIProcessIdentifier:(pid_t)pid; > +- (void)unregisterRemoteUIProcessIdentifier:(pid_t)pid; > +@end These go in AppKitSPI, not AppKitSoftLink. Probably in a macCatalyst-only section. Also, the category name should have a space before the opening paren.
Eric Liang
Comment 15 2019-11-04 16:31:07 PST
Tim Horton
Comment 16 2019-11-06 14:46:06 PST
Comment on attachment 382786 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382786&action=review > Source/WebCore/PAL/pal/spi/cocoa/NSAccessibilitySPI.h:66 > +SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, AppKit) > +SOFT_LINK_CLASS_FOR_HEADER(PAL, NSAccessibilityRemoteUIElement) You moved too much :) These (soft linking bits) should be in -SoftLinking.h/.mm files like they were. Just the forward declarations needed to move here. Other than that this looks good.
Eric Liang
Comment 17 2019-11-06 17:56:31 PST
WebKit Commit Bot
Comment 18 2019-11-06 23:03:24 PST
Comment on attachment 382995 [details] Patch Clearing flags on attachment: 382995 Committed r252175: <https://trac.webkit.org/changeset/252175>
WebKit Commit Bot
Comment 19 2019-11-06 23:03:26 PST
All reviewed patches have been landed. Closing bug.
Per Arne Vollan
Comment 20 2019-11-08 10:54:07 PST Comment hidden (obsolete)
Per Arne Vollan
Comment 21 2019-11-08 10:54:08 PST Comment hidden (obsolete)
chris fleizach
Comment 22 2019-11-08 10:56:03 PST Comment hidden (obsolete)
Tim Horton
Comment 23 2019-11-08 11:03:10 PST Comment hidden (obsolete)
Note You need to log in before you can comment on or make changes to this bug.