-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Make sliderInput() accessible for keyboard and screen readers #3011
base: main
Are you sure you want to change the base?
Conversation
d9982a4
to
2691bcd
Compare
There's one extra stop before the slider widget when tabbing through because As a minimal example, I've run the following: library(shiny)
example(sliderInput) You'd find the following
|
Current issue I've noticed is as follows:
|
Ideally, we would like to integrate the two tabbable focus into one tab-focus area where we can adjust values and check the results at the same time via assistive technologies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! Now it is very accessible to screen readers! Thanks a lot!
Unfortunately ion.RangeSlider doesn't seem to support keyboard control of both slider handles (just the from handle) IonDen/ion.rangeSlider#548 That restriction is likely going to prevent us from being able to have a fully accessible slider when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately ion.RangeSlider doesn't seem to support keyboard control of both slider handles (just the from handle) IonDen/ion.rangeSlider#548
That restriction is likely going to prevent us from being able to have a fully accessible slider when
value
is of length 2 without a significant patch to ion.RangeSlider
This is odd. At least, there should then be a way for us to bind aria
markups to the from value of a double-handle slider.
I tested with the following classes by assigning all the necessary aria labels; unfortunately, none of them worked. We may want to find a way for keyboard users to control lower value of a double-handle sliderbar at least.
.irs-line
(you know, this is the right place for a single-handle slider, but it does NOT work for the double-handle one).irs-from
(this is what you've assigned, and this does not work, either.).irs-line-left
(I gave it a try, but it did not work)
} | ||
line.attr("tabindex", "-1"); | ||
var from = data.slider.find(".irs-from"); | ||
setAriaLabels(from, label + "-lower", data.from, data.min, data.max); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
el.id + "-label"
is tied to ./R/input-utils.R#L7
, and is calling a label string defined within shinyInputLabel()
.
This is not a right way to concatenate label string. Please take a look at this document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make an invisible <span id = "lower">
with the inner text as "lower", and then pass this span id to the aria-labelledby right after the original label id using a whitespace separator to concatenate. I know, it is sort of tricky... I'm sorry.
} | ||
line.attr("tabindex", "-1"); | ||
var from = data.slider.find(".irs-from"); | ||
setAriaLabels(from, label + "-lower", data.from, data.min, data.max); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
el.id + "-label"
is tied to ./R/input-utils.R#L7
, and is calling a label string defined within shinyInputLabel()
.
This is not a right way to concatenate label string. Please take a look at this document.
var from = data.slider.find(".irs-from"); | ||
setAriaLabels(from, label + "-lower", data.from, data.min, data.max); | ||
var to = data.slider.find(".irs-to"); | ||
setAriaLabels(to, label + "-upper", data.to, data.min, data.max); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same issue as the above.
Any updates on this? I have an app with a slider for which it'd be nice to have screen reader navigability. |
Supercedes #3003
Testing notes
Ensure the following example is fully accessible (i.e., screen reader makes announcements of min/max/values and values can be changes without a mouse by tabbing)