Skip to content

Conversation

@azuev-java
Copy link
Member

@azuev-java azuev-java commented Jul 3, 2025

  • Copyright year update;
  • Introduce new function requestNodeAttribute and refactor code to use it;
  • Fix some typos;
  • Enable new code to handle TabPages since TabGroup was implemented;

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)

Issue

  • JDK-8361379: [macos] Refactor accessibility code to retrieve attribute by name (Enhancement - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1840

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

Using diff file

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

Using Webrev

Link to Webrev Comment

… name

- Copyright year update
- Introduce new function requestNodeAttribute and refactor code to use it
- Fix some typos
- Enable new code to handle TabPages since TabGroup was implemented
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 3, 2025

👋 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
Copy link

openjdk bot commented Jul 3, 2025

@azuev-java This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8361379: [macos] Refactor accessibility code to retrieve attribute by name

Reviewed-by: angorya, arapte

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 10 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Ready for review label Jul 3, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 3, 2025

Webrevs

@victordyakov
Copy link
Collaborator

@andy-goryachev-oracle @arapte please review

@andy-goryachev-oracle
Copy link
Contributor

/reviewers 2

@openjdk
Copy link

openjdk bot commented Jul 8, 2025

@andy-goryachev-oracle
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).

[rolesMap setObject:@"JFXRadiobuttonAccessibility" forKey:@"RADIO_BUTTON"];
// Requires TAB_GROUP to be implemented first
// [rolesMap setObject:@"JFXRadiobuttonAccessibility" forKey:@"TAB_ITEM"];
[rolesMap setObject:@"JFXRadiobuttonAccessibility" forKey:@"TAB_ITEM"];
Copy link
Contributor

Choose a reason for hiding this comment

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

this change seems unrelated - is it a part of some other work?

Copy link
Member Author

Choose a reason for hiding this comment

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

When i implemented radio buttons one of the roles this implementation was supposed to fulfill was tab button for the tabbed pane. But without the new implementation of Tab Group it did not work - focus was funky and announcement was not correct. So i commented out this role assignment. When i pushed Tab Group implementation i haven't uncommented this line so now since i do clean up and refactoring on this exact file i tested that now it works properly and uncommented it. Just trying not to spawn too many pull requests for the minimal changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

does it mean we missed something during the testing, something was supposed to work and did not?

since there will be more a-y work, I think it should be ok.

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.

Like this very much, a good cleanup.


- (jobject)getJAccessible
{
- (jobject)getJAccessible {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this K&R brace be reverted to the objectively better style used elsewhere in this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would object to objectively - i think this is subjective - but sure, i will fix that :)

GET_MAIN_JENV;
if (env == NULL) return NULL;
jresult = (jobject)(*env)->CallLongMethod(env, self->jAccessible, jAccessibilityAttributeValue, (jlong)@"AXValue");
jresult = (jobject)(*env)->CallLongMethod(env, [self getJAccessible],
Copy link
Contributor

Choose a reason for hiding this comment

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

not an expert, but do we really need to initialize jresult to NULL in line 110?
can the variable be declared in line 113 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well this pattern was used to initialize the result value to the default return value so if assignment does not happen due to the Java exception we have something meaningful to return but in case of NULL it is not really required because it will produce the same result anyways.

NSSize size = [variantToID(env, jresult) sizeValue];
id p = [self requestNodeAttribute:@"AXPosition"];
id s = [self requestNodeAttribute:@"AXSize"];
if (p == NULL || s == NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not a big issue, but would it be (marginally) better to bail out early if p == NULL ?

Copy link
Member Author

Choose a reason for hiding this comment

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

But that would require two conditions - one for position and one for size - with the same logic which would look not that compact and pretty.

Copy link
Contributor

Choose a reason for hiding this comment

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

but it will save a couple of nanoseconds!

the code is ok. one question though: what are the circumstances when these calls would return NULL?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Custom component that has no role assigned at all
  2. Exception happens on Java side processing the request
    That was just two popped out - probably there are more scenarios.

Copy link
Contributor

Choose a reason for hiding this comment

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

right, thank you for clarification!

@andy-goryachev-oracle
Copy link
Contributor

I don't see any obvious issues in the monkey tester with the Logging -> Accessibility enabled.

Here, for example, what it logs for the focusable label:

{time:1752011850468, log:"accessibility", "TEXT":"\"[🇺🇦❤️🇺🇸🦋🏁🔥\n😀😃😄😁😆😅🤣😂\n🙂🙃😉😊😇]\""}
{time:1752011850468, log:"accessibility", "ROLE":"\"TEXT\""}
{time:1752011850468, log:"accessibility", "LABELED_BY":"null"}

@azuev-java
Copy link
Member Author

@arapte Can you please take a look?

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

@openjdk openjdk bot added the ready Ready to be integrated label Jul 16, 2025
@azuev-java
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 16, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 16, 2025

@azuev-java Pushed as commit 2dd9026.

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

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