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

Use accessibleName instead of innerContent. #875

Open
1 of 5 tasks
pixelzoom opened this issue Oct 14, 2024 · 5 comments
Open
1 of 5 tasks

Use accessibleName instead of innerContent. #875

pixelzoom opened this issue Oct 14, 2024 · 5 comments
Assignees

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Oct 14, 2024

Related to phetsims/models-of-the-hydrogen-atom#67 ...

I'm creating this issue in scenery-phet, but it's relevant to all places where accessibleName should be used.

I asked about the different between innerContent and accessibleName. @jessegreenberg replied in Slack#DM:

In ParallelDOM.ts, we have a "lower level" and "higher level" API. The lower level is where we started, it lets you customize the markup in the PDOM quite a bit. The higher level is more simple, and lets you set things like the accessible name and help text without needing to understand the markup as much.

There is current inconsistency in which API is used. Some common-code components are setting innerContent instead of accessibleName. And this has been causing confusion while trying to implement accessible names in MOTHA phetsims/models-of-the-hydrogen-atom#67. @jessegreenberg and I think that we should be using accessibleName (the higher-level API) whenever possible, which means changing innerContent to accessibleName.

An incomplete list of examples:

  • CloseButton
  • ResetAllButton
  • StepButton
  • SoundToggleButton
  • MeasuringTapeNode?
@pixelzoom
Copy link
Contributor Author

Looks like the CloseButton change was pushed as part of work related to GrabDragInteraction: 4d7f8fb

@zepumph
Copy link
Member

zepumph commented Oct 15, 2024

You should look for usages of labelContent too as part of this issue.

  • TimeSpeedRadioButtonGroup.ts
  • TimeControlNode.ts
  • LaserPointerNode.ts

In general I think this issue is quite simple, you just need to overwrite accessibleNameBehavior to forward the accessibleName value to where it should go. The default is defined here: https://github.com/phetsims/scenery/blob/bfa0d2e25d033cf44e688b2633f2492690f97df0/js/accessibility/pdom/ParallelDOM.ts#L3265-L3277

@zepumph
Copy link
Member

zepumph commented Oct 15, 2024

Are we also going to have a similar issue in sun?

@pixelzoom
Copy link
Contributor Author

@zepumph asked:

Are we also going to have a similar issue in sun?

Yes. In the first comment, I said:

I'm creating this issue in scenery-phet, but it's relevant to all places where accessibleName should be used.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Oct 25, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants