question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

aria-label and aria-valuetext

See original GitHub issue

I can see that <DefautlHandle/> does declare aria-label and aria-valuetext properties. https://github.com/airbnb/rheostat/blob/563f6a739023dbd3c77311323de109ae66c4ac7c/src/DefaultHandle.jsx#L13-L14

Still, <Handle/> doesn’t get passed these two properties. https://github.com/airbnb/rheostat/blob/master/src/Slider.jsx#L803-L821

At the same time, there’s handle property which is for React.Component. So I suppose a developer is supposed to pass their own handle component which must wrap the <DefaultHandle/>. Like this:

function CustomHandle(props) {
  return (
    <DefaultHandle
      {...props}
      aria-label={props['data-handle-key'] === 0 ? 'Minimum price' : 'Maximum price'}
      aria-valuetext={'$' + props['aria-valuenow']}/>
  )
}

Is this the recommended approach to add aria-label and aria-valuetext? If yes then is DefaultHandle being exported from the library or should it be imported from as rheostat/src/DefaultHandle.jsx?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
catamphetaminecommented, Sep 17, 2019

@droda59 I don’t know what exactly worked, but something surely did.

import Rheostat from 'rheostat';

        <Rheostat
          snap={snap}
          handle={currency === 'USD' ? PriceHandleUSD : Handle}
          min={min}
          max={max}
          values={[currentRefinement.min, currentRefinement.max]}
          onChange={this.onChange}
          onValuesUpdated={this.onValuesUpdated}
          disabled={this.props['aria-hidden'] ? true : undefined} />

function PriceHandleUSD(props) {
  return (
    <Handle
      {...props}
      aria-label={props['data-handle-key'] === 0 ? 'Minimum price' : 'Maximum price'}
      aria-valuetext={'$' + props['aria-valuenow']} />
  );
}


function Handle(props) {
  return (
    <button
      type="button"
      aria-label={props['data-handle-key'] === 0 ? 'From' : 'To'}
      {...props}
      tabIndex={props['aria-disabled'] ? -1 : props.tabIndex} />
  );
}
1reaction
catamphetaminecommented, Dec 30, 2018

That works, closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aria-valuetext - Accessibility - MDN Web Docs - Mozilla
The aria-valuetext attribute defines the human readable text alternative of aria-valuenow for a range widget.
Read more >
WAI-ARIA: aria-valuetext (Property) - DigitalA11Y
Description. Defines the human readable text alternative of aria-valuenow for a range widget. This property is used, for example, ...
Read more >
Technique ARIA8:Using aria-label for link purpose - W3C
In some assistive technologies the aria-label value will show in the list of links instead of the actual link text. Per the Accessible...
Read more >
aria-label - examples and best practices - Aditus
aria -label is an attribute defined in the WAI-ARIA(opens in a new tab) specification. This specification extends native HTML, allowing you to change...
Read more >
Aria-labelledby vs. Aria-describedby vs. Aria-label
PRESENTER: The aria-labelledby aria-describedby and aria-label attributes can provide an ... and the matching ID value is applied to the label element.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found