Post

How do you make a button that doesn't change it's width when it's in a loading state? Use CSS Grid to stack items, and visibility: hidden to hide/show spinner! This approach allows the largest item to size the button, and keeps the button text accessible

It's good, but this is better in some cases, and is accessible. I address both approaches in the video

0 reposts3 likes

I think ideally you'd use aria-live to announce that a save is happening - but as always, it depends on what you are doing

I see what you’re getting at. I’ve never really worried about updating the text to “Saving…” but that makes sense. I’m no accessibility expert, happy to learn another nugget.

Re: accessibility: while this is ok, it's generally better to use actual text (probably a `.sr-only` span) than `aria-label`. Text is more easily picked up by ATs universally, and can also be translated to other languages more easily than HTML attributes. Plus: don't use ARIA if you don't have to.