Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix accessibility not reporting changes #842

Merged
merged 1 commit into from
Oct 7, 2023
Merged

Conversation

m-sasha
Copy link
Member

@m-sasha m-sasha commented Sep 25, 2023

sun.lwawt.macosx.CAccessible does this weird thing:

    private CAccessible(final Accessible accessible) {
        ...
        if (accessible instanceof Component) {
            addNotificationListeners((Component)accessible);
        }
    }

    public void addNotificationListeners(Component c) {
        if (c instanceof Accessible) {
            AccessibleContext ac = ((Accessible)c).getAccessibleContext();
            ac.addPropertyChangeListener(new AXChangeNotifier());
        }
    }

So unless the Accessible is an instance of java.awt.Component, it will not register its property change listener with its accessible context. This prevents us from notifying it when a value changes (a progress bar updates for example).

Proposed Changes

Make ComposeAccessible a subclass of java.awt.Component.

This also requires renaming its accessibleContext property, because java.awt.Component already has a protected field with the same name.

Testing

Test: Can't test this without exposing something about the amount of property change listeners registered with ComposeAccessibleComponent. Tested manually with a progress bar (needs a bit of additional code, which I'll add in the next PR).

@m-sasha m-sasha requested a review from Walingar September 25, 2023 14:08
@Walingar
Copy link
Collaborator

LGTM, checked on MacOs it works fine. Didn't notice regressions. Still need to check on Windows

…ibleComponent, preventing us from reporting changes to it.
@m-sasha m-sasha force-pushed the m-sasha/live-a11y branch from f74b95f to 5ce7be0 Compare October 7, 2023 07:54
@m-sasha m-sasha merged commit c4b9e67 into jb-main Oct 7, 2023
1 check passed
@m-sasha m-sasha deleted the m-sasha/live-a11y branch October 7, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants