Skip to content

Conversation

@azuev-java
Copy link
Member

@azuev-java azuev-java commented Aug 29, 2023

Create implementation for Slider and Stepper accessibility protocols.
Fix mapping.
Fix performAction parameter type in declaration.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issues

  • JDK-8313556: Create implementation of NSAccessibilitySlider protocol (Enhancement - P4)
  • JDK-8313558: Create implementation of NSAccessibilityStepper protocol (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1226/head:pull/1226
$ git checkout pull/1226

Update a local copy of the PR:
$ git checkout pull/1226
$ git pull https://git.openjdk.org/jfx.git pull/1226/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1226

View PR using the GUI difftool:
$ git pr show -t 1226

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1226.diff

Using Webrev

Link to Webrev Comment

Create implementation for Slider and Stepper accessibility protocols.
Fix mapping.
Fix performAction parameter type in declaration.
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 29, 2023

👋 Welcome back kizune! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title 8313556: Create implementation of NSAccessibilitySlider protocol 8313556: Create implementation of NSAccessibilitySlider protocol Aug 29, 2023
@openjdk openjdk bot added the rfr Ready for review label Aug 29, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 29, 2023

@azuev-java
Copy link
Member Author

/issue add JDK-8313558

@openjdk
Copy link

openjdk bot commented Aug 29, 2023

@azuev-java
Adding additional issue to issue list: 8313558: Create implementation of NSAccessibilityStepper protocol.

@kevinrushforth kevinrushforth requested a review from arapte August 29, 2023 12:11
@kevinrushforth
Copy link
Member

Reviewers: @arapte @andy-goryachev-oracle

@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Aug 29, 2023

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@andy-goryachev-oracle
Copy link
Contributor

should there be an automated test for the added functionality?

@kevinrushforth
Copy link
Member

should there be an automated test for the added functionality?

Automated testing of the screen reader is not feasible. Even if it were, it would be a separate enhancement to add accessibility tests. Btw, this PR isn't providing new functionality. It is providing a new implementation of existing functionality.

Having said that, it would be helpful for Alex to list the controls that will use the new implementation, so reviewers can test it manually. For this PR, I would imagine that the Slider and Spinner controls would be used to test the NSAccessibilitySlider and NSAccessibilityStepper protocols, respectively. Perhaps there are also other ways to hit the new code?

@andy-goryachev-oracle
Copy link
Contributor

Thank you for clarification, Kevin.
The two linked tickets, and the associated umbrella tickets talk about providing a parallel implementation of the a*y feature, meaning both old and new interfaces will be available for some time, do I read it correctly? If so, how do we ensure that the new implementation is being used by the OS?

@kevinrushforth
Copy link
Member

Yes, you read it correctly. Good question about how you can tell that it is going through the new implementation. Since it is supposed to transparently do the same thing, the only way I can think of is to instrument the code to add debug logging statement (which is what I did when reviewing the initial changes).

@andy-goryachev-oracle
Copy link
Contributor

perhaps the logging statements should be added (commented out) as a part of this PR.

@azuev-java
Copy link
Member Author

perhaps the logging statements should be added (commented out) as a part of this PR.

I can do that - i usually refrained from doing so because code would look not very clean but basically the only way to tell that it goes trough the new code should be debug output - if behavior changes it should be considered as a potential bug (not always because if i see that the old behavior is incorrect i would not go out of my way to recreate the obviously flawed logic) but in general the idea is that new code should behave exactly the same as the old one.

@andy-goryachev-oracle
Copy link
Contributor

what I meant is that commented out logging statements should be left in the code, so the reviewers can uncomment them and test. like this:

// System.err.println("it works");

@azuev-java
Copy link
Member Author

azuev-java commented Aug 29, 2023

Having said that, it would be helpful for Alex to list the controls that will use the new implementation, so reviewers can test it manually.

I will definitely do that in the future. In this case you are right the controls are Spinner and Slider and while we have a dedicated control group for Spinner component in Ensemble there is no such thing for Slider (or i haven't found it) so the best way to test it is to go to the ColorPicker component test, invoke color chooser and click "Custom Color..." link - that will invoke the color selection dialog that has a lot of sliders to play with.

@azuev-java
Copy link
Member Author

what I meant is that commented out logging statements should be left in the code, so the reviewers can uncomment them and test. like this:

// System.err.println("it works");

Did that. I would just appreciate if you or any other reviewer reminds me to remove these statements after we are done with the review :) The code should print out when slider or stepper values are being changed using the a11y shortcuts to manipulate controls. That will ensure that when being accessed trough the a11y handle the component state can be appropriately updated. And of course it will indicate that the new component is invoked.

@arapte
Copy link
Member

arapte commented Aug 30, 2023

I observed few warnings and behavioral differences.

  • Warnings:
  1. modules/javafx.graphics/src/main/native-glass/mac/a11y/JFXSliderAccessibility.m:32:17: warning: method 'accessibilityFrame' in protocol 'NSAccessibilityElement' not implemented [-Wprotocol]
  2. modules/javafx.graphics/src/main/native-glass/mac/a11y/JFXSliderAccessibility.m:32:17: warning: method 'accessibilityParent' in protocol 'NSAccessibilityElement' not implemented [-Wprotocol]
  3. modules/javafx.graphics/src/main/native-glass/mac/a11y/JFXStepperAccessibility.m:32:17: warning: method 'accessibilityFrame' in protocol 'NSAccessibilityElement' not implemented [-Wprotocol]
  4. modules/javafx.graphics/src/main/native-glass/mac/a11y/JFXStepperAccessibility.m:32:17: warning: method 'accessibilityParent' in protocol 'NSAccessibilityElement' not implemented [-Wprotocol]
  5. modules/javafx.graphics/src/main/native-glass/mac/a11y/AccessibleBase.m:247:21: warning: 'NSObject' may not respond to 'clearParent'
  • Behavior differences:
  1. Spinner: Changed values are not read by VoiceOver when we increase or decrease the value using arrow keys or using Ctrl + Option + Up/Down keys ( Tested with Spinner app in Ensemble )
  2. Slider: Values are read without % as suffix ( Tested with Styled tool bar app in Ensemble )

@andy-goryachev-oracle
Copy link
Contributor

Testing with macOS 13.3.1a and Voice Over, using MonkeyTester
https://github.com/andy-goryachev-oracle/MonkeyTest

Observed a number of things, some possibly not related to this PR:

  1. had color picker custom color dialog opened when turning on VoiceOver, saw stderr output:
    *** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 873

  2. color picker, custom color: hue slider is not accessible

  3. color picker, slider (opacity):

  • shows 46 (%), announces: 46.3
  • no NSLog debug output if using left/right arrow
  • when entering slider via shift-ctrl-option-down arrow, does not announce how to control the slider (as it did with spinner).
  • when controlling the spinner with ctrl-option-up/down, I see NSLog debug output:

2023-08-31 08:09:03.087 java[45918:3234828] Slider decrement action invoked
2023-08-31 08:09:04.565 java[45918:3234828] Slider increment action invoked

  1. spinner: see debug output when using ctrl-option-up/down, but change in value is not announced
    2023-08-31 08:05:12.267 java[45918:3234828] Stepper decrement action invoked
    2023-08-31 08:05:13.192 java[45918:3234828] Stepper increment action invoked

  2. spinner: when in spinner (via shift-ctrl-option-down), trying to control the spinner via ctrl-option-up/down, releasing the last button moves the focus to the menu instead of staying in the spinner.

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 28, 2023

@azuev-java This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 26, 2023

@azuev-java This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Oct 26, 2023
azuev-java and others added 2 commits November 15, 2023 12:50
@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Feb 26, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Feb 26, 2025
Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM... Tested the behavior of both controls, observed no problem.
Providing a minor query, If you choose to make the change I shall re-approve.

Comment on lines +156 to +165
- (id)accessibilityTitle
{
jobject jresult = NULL;
GET_MAIN_JENV;
if (env == NULL) return NULL;
jresult = (jobject)(*env)->CallLongMethod(env, self->jAccessible,
jAccessibilityAttributeValue, (jlong)@"AXTitle");
GLASS_CHECK_EXCEPTION(env);
return variantToID(env, jresult);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is same as accessibilityLabel. Should we change implementation to call one method from the other ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@andy-goryachev-oracle
Copy link
Contributor

With Slider, it announces the current value as "percent" (of the working envelope?), even though the min/max can be arbitrary. Is this intentional?

Also, for Spinner, it says "Stepper", is this expected?

macOS 15.3.1 M1

@andy-goryachev-oracle
Copy link
Contributor

Is this PR related to https://git.openjdk.org/jdk/pull/23841 in any way?

@azuev-java
Copy link
Member Author

With Slider, it announces the current value as "percent" (of the working envelope?), even though the min/max can be arbitrary. Is this intentional?

Also, for Spinner, it says "Stepper", is this expected?

macOS 15.3.1 M1

I need to check that.

@azuev-java
Copy link
Member Author

Is this PR related to https://git.openjdk.org/jdk/pull/23841 in any way?

Not directly. The event delivery in AWT/Swing and in JavaFX works quite differently so i will check if the new implementation here is affected by the same problem - but i doubt so.

@azuev-java
Copy link
Member Author

Also, for Spinner, it says "Stepper", is this expected?

On macOS the control we call Spinner is called Stepper, there's no Spinner.

From macOS UI guide: "A stepper is a two-segment control that people use to increase or decrease an incremental value."

@andy-goryachev-oracle
Copy link
Contributor

andy-goryachev-oracle commented Mar 5, 2025

Spinner is called Stepper

yep, that's what I suspected. thanks!

so the remaining question is whether it should announce "percent" of the slider position or the actual value?

@azuev-java
Copy link
Member Author

so the remaining question is whether it should announce "percent" of the slider position or the actual value?

Unfortunately we do not have any control on that. There is no way to tell VoiceOver if it is percent or the raw value - VO deducts it based on its own logic. The only way to customize the VO heuristics is to override accessibilityValueDescription function and return string for VO but then we would need to decode for ourselves how do we convert the value plus it will be our responsibility to do localization of this string if needed.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, you are right: we don't want to deal with interpreting and l10n.

@azuev-java azuev-java requested a review from arapte March 5, 2025 17:51
@openjdk openjdk bot added the ready Ready to be integrated label Mar 5, 2025
@azuev-java
Copy link
Member Author

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label Mar 6, 2025
@openjdk
Copy link

openjdk bot commented Mar 6, 2025

@azuev-java
Your change (at version 1ae393a) is now ready to be sponsored by a Committer.

@arapte
Copy link
Member

arapte commented Mar 6, 2025

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 6, 2025

Going to push as commit c7091e1.
Since your change was applied there have been 4 commits pushed to the master branch:

  • 0a20fef: 8327478: Add System test to verify TextSelection issue for webkit-617.1
  • fc770fb: 8349091: Charts: exception initializing in a background thread
  • 1824db5: 8299753: Tree/TableView: Column Resizing With Fractional Scale
  • f3ba448: 8233179: VetoableListDecorator#sort throws IllegalArgumentException "duplicate children"

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 6, 2025
@openjdk openjdk bot closed this Mar 6, 2025
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review sponsor Ready to sponsor labels Mar 6, 2025
@openjdk
Copy link

openjdk bot commented Mar 6, 2025

@arapte @azuev-java Pushed as commit c7091e1.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@azuev-java azuev-java deleted the JDK-8313556 branch May 30, 2025 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants