1

Overloading buttons

 1 year ago
source link: https://adactio.com/journal/19560
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Journal—Overloading buttons

Overloading buttons

October 30th, 2022

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.

10:52am

Tagged with aria accessibility a11y buttons interface ui attributes progressive disclosure frontend development toggles state thesession audio

Also on Medium

Older »

Have you published a response to this? Let me know the URL:

Responses

1 Like

# Liked by Chris Burnell on Sunday, October 30th, 2022 at 12:38pm

Previously on this day

12 years ago I wrote Layered

Commentary on a Layer Tennis match.

Saturday, October 30th, 2010 12:35am

15 years ago I wrote Return from San Francisco

I had a blast… as always.

Tuesday, October 30th, 2007 5:53pm

20 years ago I wrote PodNews 3: Your iPod's best friend.

What do you get when you take two great things, the iPod and RSS, and combine them? You get PodNews 3.

Wednesday, October 30th, 2002 11:20pm

20 years ago I wrote Despair, Inc.

Are you sick of those "inspirational" posters with pithy sayings presented underneath pictures of cute animanals and/or sweeping landscapes?

Wednesday, October 30th, 2002 9:33pm

21 years ago I wrote Squier P-Bass Special

There’s nothing quite like getting a new and better musical instrument (except maybe getting a new and better computer).

Tuesday, October 30th, 2001 12:59pm

More information

© 1998 - 2022 Jeremy Keith.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK