Bug 263736 - AX: Add functionality to request AX clients to announce a given message to the user.
Summary: AX: Add functionality to request AX clients to announce a given message to th...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Andres Gonzalez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-26 11:54 PDT by Andres Gonzalez
Modified: 2023-11-02 13:28 PDT (History)
10 users (show)

See Also:


Attachments
Patch (4.87 KB, patch)
2023-10-26 13:45 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (6.92 KB, patch)
2023-10-27 09:23 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (11.83 KB, patch)
2023-10-30 12:07 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (20.05 KB, patch)
2023-10-31 09:01 PDT, Andres Gonzalez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (20.04 KB, patch)
2023-10-31 10:16 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (20.23 KB, patch)
2023-10-31 12:43 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (21.84 KB, patch)
2023-11-01 06:45 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (21.91 KB, patch)
2023-11-01 08:25 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Gonzalez 2023-10-26 11:54:25 PDT
.
Comment 1 Radar WebKit Bug Importer 2023-10-26 11:54:40 PDT
<rdar://problem/117544889>
Comment 2 Andres Gonzalez 2023-10-26 13:45:33 PDT
Created attachment 468359 [details]
Patch
Comment 3 chris fleizach 2023-10-26 14:19:06 PDT
Comment on attachment 468359 [details]
Patch

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

> Source/WebCore/accessibility/mac/AXObjectCacheMac.mm:302
> +void AXObjectCache::announce(const String& message)

can we also add the iOS version of this too
Comment 4 Andres Gonzalez 2023-10-27 09:23:27 PDT
Created attachment 468370 [details]
Patch
Comment 5 Andres Gonzalez 2023-10-27 09:24:51 PDT
(In reply to chris fleizach from comment #3)
> Comment on attachment 468359 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=468359&action=review
> 
> > Source/WebCore/accessibility/mac/AXObjectCacheMac.mm:302
> > +void AXObjectCache::announce(const String& message)
> 
> can we also add the iOS version of this too

Done, thanks.
Comment 6 chris fleizach 2023-10-27 09:38:36 PDT
Comment on attachment 468370 [details]
Patch

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

> Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:47
> +    relayNotification(UIAccessibilityAnnouncementNotification, [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding]);

For iOS, i think what we need to do is

 postPlatformNotification(object, AXAnnouncement);

then add

AXAnnouncement to
enum AXNotification


then we need to update

ASCIILiteral AXObjectCache::notificationPlatformName(AXNotification notification)
{

to add the enum to string mapping
Comment 7 Andres Gonzalez 2023-10-27 10:31:54 PDT
(In reply to chris fleizach from comment #6)
> Comment on attachment 468370 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=468370&action=review
> 
> > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:47
> > +    relayNotification(UIAccessibilityAnnouncementNotification, [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding]);
> 
> For iOS, i think what we need to do is
> 
>  postPlatformNotification(object, AXAnnouncement);
> 
> then add
> 
> AXAnnouncement to
> enum AXNotification
> 
> 
> then we need to update
> 
> ASCIILiteral AXObjectCache::notificationPlatformName(AXNotification
> notification)
> {
> 
> to add the enum to string mapping

This is intended for a message that is not associated with any object, so postPlatformNotification is not the path here. I'll change the AXNotification to platform notification name mapping.
Comment 8 chris fleizach 2023-10-27 10:52:55 PDT
(In reply to Andres Gonzalez from comment #7)
> (In reply to chris fleizach from comment #6)
> > Comment on attachment 468370 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=468370&action=review
> > 
> > > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:47
> > > +    relayNotification(UIAccessibilityAnnouncementNotification, [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding]);
> > 
> > For iOS, i think what we need to do is
> > 
> >  postPlatformNotification(object, AXAnnouncement);
> > 
> > then add
> > 
> > AXAnnouncement to
> > enum AXNotification
> > 
> > 
> > then we need to update
> > 
> > ASCIILiteral AXObjectCache::notificationPlatformName(AXNotification
> > notification)
> > {
> > 
> > to add the enum to string mapping
> 
> This is intended for a message that is not associated with any object, so
> postPlatformNotification is not the path here. I'll change the
> AXNotification to platform notification name mapping.

interestingly, most of these notifications aren't associated with the user, but we need to pass these through the postPlatformNotification so that the webkit bundle can process the notifications correctly
Comment 9 Andres Gonzalez 2023-10-27 13:28:41 PDT
(In reply to chris fleizach from comment #8)
> (In reply to Andres Gonzalez from comment #7)
> > (In reply to chris fleizach from comment #6)
> > > Comment on attachment 468370 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=468370&action=review
> > > 
> > > > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:47
> > > > +    relayNotification(UIAccessibilityAnnouncementNotification, [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding]);
> > > 
> > > For iOS, i think what we need to do is
> > > 
> > >  postPlatformNotification(object, AXAnnouncement);
> > > 
> > > then add
> > > 
> > > AXAnnouncement to
> > > enum AXNotification
> > > 
> > > 
> > > then we need to update
> > > 
> > > ASCIILiteral AXObjectCache::notificationPlatformName(AXNotification
> > > notification)
> > > {
> > > 
> > > to add the enum to string mapping
> > 
> > This is intended for a message that is not associated with any object, so
> > postPlatformNotification is not the path here. I'll change the
> > AXNotification to platform notification name mapping.
> 
> interestingly, most of these notifications aren't associated with the user,
> but we need to pass these through the postPlatformNotification so that the
> webkit bundle can process the notifications correctly

To go that path, we then need to modify

- (void)accessibilityOverrideProcessNotification:(NSString *)notificationName
{
    // This is overridden by the Accessibility system to post-process notifications.
    // When it is done, it will call back into handleNotificationRelayToChrome.
}

To take an additional NSString *message. Is that what you are proposing?
Comment 10 chris fleizach 2023-10-27 14:05:03 PDT
(In reply to Andres Gonzalez from comment #9)
> (In reply to chris fleizach from comment #8)
> > (In reply to Andres Gonzalez from comment #7)
> > > (In reply to chris fleizach from comment #6)
> > > > Comment on attachment 468370 [details]
> > > > Patch
> > > > 
> > > > View in context:
> > > > https://bugs.webkit.org/attachment.cgi?id=468370&action=review
> > > > 
> > > > > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:47
> > > > > +    relayNotification(UIAccessibilityAnnouncementNotification, [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding]);
> > > > 
> > > > For iOS, i think what we need to do is
> > > > 
> > > >  postPlatformNotification(object, AXAnnouncement);
> > > > 
> > > > then add
> > > > 
> > > > AXAnnouncement to
> > > > enum AXNotification
> > > > 
> > > > 
> > > > then we need to update
> > > > 
> > > > ASCIILiteral AXObjectCache::notificationPlatformName(AXNotification
> > > > notification)
> > > > {
> > > > 
> > > > to add the enum to string mapping
> > > 
> > > This is intended for a message that is not associated with any object, so
> > > postPlatformNotification is not the path here. I'll change the
> > > AXNotification to platform notification name mapping.
> > 
> > interestingly, most of these notifications aren't associated with the user,
> > but we need to pass these through the postPlatformNotification so that the
> > webkit bundle can process the notifications correctly
> 
> To go that path, we then need to modify
> 
> - (void)accessibilityOverrideProcessNotification:(NSString *)notificationName
> {
>     // This is overridden by the Accessibility system to post-process
> notifications.
>     // When it is done, it will call back into
> handleNotificationRelayToChrome.
> }
> 
> To take an additional NSString *message. Is that what you are proposing?

yea we will need to do that.
Comment 11 Andres Gonzalez 2023-10-30 12:07:12 PDT
Created attachment 468413 [details]
Patch
Comment 12 Andres Gonzalez 2023-10-30 12:19:01 PDT
(In reply to chris fleizach from comment #10)
> (In reply to Andres Gonzalez from comment #9)
> > (In reply to chris fleizach from comment #8)
> > > (In reply to Andres Gonzalez from comment #7)
> > > > (In reply to chris fleizach from comment #6)
> > > > > Comment on attachment 468370 [details]
> > > > > Patch
> > > > > 
> > > > > View in context:
> > > > > https://bugs.webkit.org/attachment.cgi?id=468370&action=review
> > > > > 
> > > > > > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:47
> > > > > > +    relayNotification(UIAccessibilityAnnouncementNotification, [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding]);
> > > > > 
> > > > > For iOS, i think what we need to do is
> > > > > 
> > > > >  postPlatformNotification(object, AXAnnouncement);
> > > > > 
> > > > > then add
> > > > > 
> > > > > AXAnnouncement to
> > > > > enum AXNotification
> > > > > 
> > > > > 
> > > > > then we need to update
> > > > > 
> > > > > ASCIILiteral AXObjectCache::notificationPlatformName(AXNotification
> > > > > notification)
> > > > > {
> > > > > 
> > > > > to add the enum to string mapping
> > > > 
> > > > This is intended for a message that is not associated with any object, so
> > > > postPlatformNotification is not the path here. I'll change the
> > > > AXNotification to platform notification name mapping.
> > > 
> > > interestingly, most of these notifications aren't associated with the user,
> > > but we need to pass these through the postPlatformNotification so that the
> > > webkit bundle can process the notifications correctly
> > 
> > To go that path, we then need to modify
> > 
> > - (void)accessibilityOverrideProcessNotification:(NSString *)notificationName
> > {
> >     // This is overridden by the Accessibility system to post-process
> > notifications.
> >     // When it is done, it will call back into
> > handleNotificationRelayToChrome.
> > }
> > 
> > To take an additional NSString *message. Is that what you are proposing?
> 
> yea we will need to do that.

Done.
Comment 13 chris fleizach 2023-10-30 13:29:26 PDT
Comment on attachment 468413 [details]
Patch

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

> Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:132
> +    [rootObject()->wrapper() accessibilityPostedNotification:notificationName.get() userInfo:@{ notificationName.get() : nsMessage }];

this has to be changed somewhere as well.

> Source/WebCore/accessibility/mac/AXObjectCacheMac.mm:304
> +    NSAccessibilityPostNotificationWithUserInfo(NSApp, NSAccessibilityAnnouncementRequestedNotification, @{

seems possible to add a test for this behavior.
Comment 14 Andres Gonzalez 2023-10-31 09:01:53 PDT
Created attachment 468426 [details]
Patch
Comment 15 Andres Gonzalez 2023-10-31 09:03:39 PDT
(In reply to chris fleizach from comment #13)
> Comment on attachment 468413 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=468413&action=review
> 
> > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:132
> > +    [rootObject()->wrapper() accessibilityPostedNotification:notificationName.get() userInfo:@{ notificationName.get() : nsMessage }];
> 
> this has to be changed somewhere as well.
> 
> > Source/WebCore/accessibility/mac/AXObjectCacheMac.mm:304
> > +    NSAccessibilityPostNotificationWithUserInfo(NSApp, NSAccessibilityAnnouncementRequestedNotification, @{
> 
> seems possible to add a test for this behavior.

Added test and consolidated iOS and MacOS implementations.
Comment 16 Andres Gonzalez 2023-10-31 10:16:55 PDT
Created attachment 468428 [details]
Patch
Comment 17 chris fleizach 2023-10-31 10:27:02 PDT
Comment on attachment 468426 [details]
Patch

build error

ERROR: symbol __ZN7WebCore13AXObjectCache8announceERKN3WTF6StringE
Command PhaseScriptExecution failed with a nonzero exit code
Comment 18 chris fleizach 2023-10-31 10:27:03 PDT
Comment on attachment 468426 [details]
Patch

build error

ERROR: symbol __ZN7WebCore13AXObjectCache8announceERKN3WTF6StringE
Command PhaseScriptExecution failed with a nonzero exit code
Comment 19 chris fleizach 2023-10-31 10:27:09 PDT
build error

ERROR: symbol __ZN7WebCore13AXObjectCache8announceERKN3WTF6StringE
Command PhaseScriptExecution failed with a nonzero exit code
Comment 20 Andres Gonzalez 2023-10-31 12:43:34 PDT
Created attachment 468431 [details]
Patch
Comment 21 Andres Gonzalez 2023-11-01 06:45:05 PDT
Created attachment 468441 [details]
Patch

Excluding test from platforms that don't implement announce.
Comment 22 Andres Gonzalez 2023-11-01 08:25:57 PDT
Created attachment 468445 [details]
Patch
Comment 23 EWS 2023-11-02 13:28:32 PDT
Committed 270135@main (4f1f74a1f3c8): <https://commits.webkit.org/270135@main>

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