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

aria-valuetext is sometimes in the wrong spot in the a11y view #896

Closed
jessegreenberg opened this issue Feb 26, 2020 · 6 comments
Closed

Comments

@jessegreenberg
Copy link
Contributor

Mentioned by @terracoda in phetsims/molecules-and-light#290.

In #660 we added aria-valuetext to the a11y-view because it provides very important ouptut (as important as alerts) and it is helpful to see. But the method of inserting it into the a11y view is naive and sometimes puts it in the wrong spot
image

"fast" aria-valuetext should be right below the slider.

@zepumph has been working on a11y-view improvements lately so assigning to him as part of that work, but let me know if I can help!

@jessegreenberg
Copy link
Contributor Author

In phetsims/molecules-and-light#290 (comment) @terracoda said

maybe it is time to think about how we could put Object Responses like current aria-valuetext over above the Context Responses, or interwoven with the the Context responses?

@zepumph
Copy link
Member

zepumph commented Feb 26, 2020

I agree that the algorithm is naive. A quick way to fix this is to surround any item with aria-valuetext with a div, this will place the aria-valuetext display next to the input element because they will be the only two items in the parent.

A better way for this to work may be to have the a11y view pull out any element with aria-valueText, and replace it with a div that has two children: then element with aria-valuetext and the valuetext display.

I'll investigate.

@terracoda
Copy link
Contributor

@zepumph, you could consider using a span element for the aria-valuetext. That might keep things on the same line.

span's are inline generic elements and div's are block-level generic elements.

@zepumph
Copy link
Member

zepumph commented Feb 26, 2020

Indeed! That said there isn't a ton of horizontal space in the PDOM copy, and aria-valuetext values can be quite long (like a sentence or phrase instead of numeric value+unit).

I'll prototype a few solutions and provide some screen shots for comparison.

zepumph added a commit to phetsims/circuit-construction-kit-dc-virtual-lab that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/balloons-and-static-electricity that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/circuit-construction-kit-dc that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/circuit-construction-kit-ac that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/gravity-force-lab-basics that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/resistance-in-a-wire that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/molecules-and-light that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/gravity-force-lab that referenced this issue Mar 18, 2020
zepumph added a commit to phetsims/john-travoltage that referenced this issue Mar 18, 2020
@zepumph zepumph assigned jessegreenberg and unassigned zepumph Mar 18, 2020
@zepumph
Copy link
Member

zepumph commented Mar 18, 2020

I updated the a11y view to insert the created aria-valuetext display element immediately after the element, and not at the end of the container. @jessegreenberg please review.

I used this snippet (added to your favorite a11y view enabled sim) to see that it was working). The valueText display should go in between the two children.

  this.addChild( new Node( {
    tagName: 'div',
    children: [
      new Node( { tagName: 'p', ariaValueText: 'hello there', innerContent: 'i have valuetext' } ),
      new Node( { tagName: 'p', innerContent: 'the after one' } )
    ]
  } ) );

@jessegreenberg
Copy link
Contributor Author

This is super nice, and looks great! I just went through a11y views and the valuetext is all nicely under each slider. Closing.

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

3 participants