Overloading buttons

It’s been almost two years since I added audio playback on The Session. The interface is quite straightforward. For any tune setting, there’s a button that says “play audio”. When you press that button, audio plays and the button’s text changes to “p…


This content originally appeared on Adactio: Journal and was authored by Adactio: Journal

It’s been almost two years since I added audio playback on The Session. The interface is quite straightforward. For any tune setting, there’s a button that says “play audio”. When you press that button, audio plays and the button’s text changes to “pause audio.”

By updating the button’s text like this, I’m updating the button’s accessible name. In other situations, where the button text doesn’t change, you can indicate whether a button is active or not by toggling the aria-pressed attribute. I’ve been doing that on the “share” buttons that act as the interface for a progressive disclosure. The label on the button—“share”—doesn’t change when the button is pressed. For that kind of progressive disclosure pattern, the button also has an aria-controls and aria-expanded attribute.

From all the advice I’ve read about button states, you should either update the accessible name or change the aria-pressed attribute, but not both. That would lead to the confusing situation of having a button labelled “pause audio” as having a state of “pressed” when in fact the audio is playing.

That was all fine until I recently added some more functionality to The Session. As well as being able to play back audio, you can now adjust the tempo of the playback speed. The interface element for this is a slider, input type="range".

But this means that the “play audio” button now does two things. It plays the audio, but it also acts as a progressive disclosure control, revealing the tempo slider. The button is simultaneously a push button for playing and pausing music, and a toggle button for showing and hiding another interface element.

So should I be toggling the aria-pressed attribute now, even though the accessible name is changing? Or is it enough to have the relationship defined by aria-controls and the state defined by aria-expanded?

Based on past experience, my gut feeling is that I’m probably using too much ARIA. Maybe it’s an anti-pattern to use both aria-expanded and aria-pressed on a progressive disclosure control.

I’m kind of rubber-ducking here, and now that I’ve written down what I’m thinking, I’m pretty sure I’m going to remove the toggling of aria-pressed in any situation where I’m already toggling aria-expanded.

What I really need to do is enlist the help of actual screen reader users. There are a number of members of The Session who use screen readers. I should get in touch and see if the new functionality makes sense to them.


This content originally appeared on Adactio: Journal and was authored by Adactio: Journal


Print Share Comment Cite Upload Translate Updates
APA

Adactio: Journal | Sciencx (2022-10-30T10:52:03+00:00) Overloading buttons. Retrieved from https://www.scien.cx/2022/10/30/overloading-buttons/

MLA
" » Overloading buttons." Adactio: Journal | Sciencx - Sunday October 30, 2022, https://www.scien.cx/2022/10/30/overloading-buttons/
HARVARD
Adactio: Journal | Sciencx Sunday October 30, 2022 » Overloading buttons., viewed ,<https://www.scien.cx/2022/10/30/overloading-buttons/>
VANCOUVER
Adactio: Journal | Sciencx - » Overloading buttons. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/10/30/overloading-buttons/
CHICAGO
" » Overloading buttons." Adactio: Journal | Sciencx - Accessed . https://www.scien.cx/2022/10/30/overloading-buttons/
IEEE
" » Overloading buttons." Adactio: Journal | Sciencx [Online]. Available: https://www.scien.cx/2022/10/30/overloading-buttons/. [Accessed: ]
rf:citation
» Overloading buttons | Adactio: Journal | Sciencx | https://www.scien.cx/2022/10/30/overloading-buttons/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.