Comments (4)
FYI the main reason why this isn't keyboard accessible is not because of the fact that it's a div (the tabIndex
value allows it to be tabbed to). It's because there is an explicit tabIndex
value set (in this case 1 and 2), which means that this slider will get tabbed to when unexpected (the 1st and 2nd elements on the page) and not get tabbed to when expected (in the natural flow of elements). Additionally, the slider controls lack any sort of highlight for when they have focus, resulting in a confusion of when they have focus. The fix would be to not allow passing in a particular tabIndex
and always setting tabIndex
to 0, in addition to adding any proper aria roles necessary.
from rheostat.
Thanks for filing @sarbbottam :)
From what I understand there's only one issue concerning rheostat and that's if we should use <button>
instead of <div>
.
I did not choose <button>
initially because the slider handles aren't meant to act as buttons. There's nothing to "press" or "click" about them. I only care about keyboard interaction and when someone drags them around.
After reading your article as well as Nicholas', which you link to at the end, I'm still not sure <button>
is the appropriate element to use here but I'd love to hear your thoughts on this.
from rheostat.
I think what we really want it to behave like is a <input type="range">
, but since the native range slider is unavailable as a standalone element, I think <button type="button">
would be the best analog (ie, keyboard+mouse -focusable and interactive). That you can't click on it is fine, I think, because it'd just be a noop.
from rheostat.
I did not choose
<button>
initially because the slider handles aren't meant to act as buttons.
@goatslacker you are right.
button
semantic is not appropriate. It could be any focusable element with role="slider"
.
As @ljharb mentioned, <button>
seems to be the best match.
I think
<button type="button">
would be the best analog
Options
- add
tabindex=0
androle="slider"
to the existingdiv
s.
div
are meant for container, I personally would not use it for any other purpose - replace
div
with button and addrole="slider"
, also update the style to make the button look like slider thumb in the current UI. - may be something else ...
Irrespective of the approach chosen, on keydown
,
- Must
Right Arrow
andUp Arrow
increase the value of the slider.Left Arrow
andDown Arrow
decrease the value of the slider.
- Good to have
Home
andEnd
move to the first and last values of the slider.Page Up
andPage Down
optionally increment or decrement the slider by a given amount.
from rheostat.
Related Issues (20)
- An in-range update of eslint is breaking the build 🚨 HOT 12
- [email protected]: Warning: componentWillReceiveProps has been renamed, and is not recommended for use HOT 4
- An in-range update of eslint-plugin-react is breaking the build 🚨 HOT 6
- An in-range update of storybook is breaking the build 🚨 HOT 38
- An in-range update of babel7 is breaking the build 🚨 HOT 28
- An in-range update of enzyme is breaking the build 🚨
- An in-range update of enzyme is breaking the build 🚨
- An in-range update of enzyme is breaking the build 🚨
- An in-range update of webpack is breaking the build 🚨 HOT 9
- An in-range update of eslint-plugin-jest is breaking the build 🚨 HOT 4
- Bundle size increased to almost 100Kb minified HOT 3
- An in-range update of eslint-plugin-import is breaking the build 🚨 HOT 3
- Aria-labels can't be added to slider buttons HOT 3
- DefaultHandle should allow children HOT 2
- can i use this library in react-native? HOT 1
- @types/rheostat values HOT 1
- An in-range update of style-loader is breaking the build 🚨 HOT 3
- RTL Support Doesn't Work HOT 6
- Background Chart Example HOT 2
- PropType warnings for not required props HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rheostat.