phetsims / scenery-phet

Reusable components based on Scenery that are specific to PhET simulations.
MIT License
8 stars 6 forks source link

Use accessibleName instead of innerContent. #875

Open pixelzoom opened 5 hours ago

pixelzoom commented 5 hours ago

Related to https://github.com/phetsims/models-of-the-hydrogen-atom/issues/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 https://github.com/phetsims/models-of-the-hydrogen-atom/issues/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:

pixelzoom commented 4 hours ago

Looks like the CloseButton change was pushed as part of work related to GrabDragInteraction: https://github.com/phetsims/scenery-phet/commit/4d7f8fbc55644792dedc6d5c73ea15426fc6b643