Skip to content
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

Support button loading state #598

Closed
mperrotti opened this issue Sep 19, 2023 · 1 comment
Closed

Support button loading state #598

mperrotti opened this issue Sep 19, 2023 · 1 comment

Comments

@mperrotti
Copy link
Contributor

This change is based on the patterns documented in #590

Our buttons don't current support a "loading" state. This may be useful for slow processes - especially when we want to block users from hitting the "submit" button multiple times.

Example

4.loadingText.mp4

Implementation considerations

When implementing a "loading" button state, don't remove the button from the DOM or pass the disabled attribute. Doing so would remove focus from the button, creating a confusing experience for assistive technologies such as a screen reader.

Instead, render the loading text in an element that is positioned on top of the button to create the illusion that the button is hidden. This will also prevent people who use a mouse cursor from clicking the button while it's in a loading state. To prevent keyboard users from activating the button, remove the click handler while the button is in a loading state.

Set the button's aria-disabled attribute to "true" while it's hidden by the loading text.

Exploded view of a save profile button with a layer above it that says 'Saving...'

Previous exploration by a11y

https://github.com/github/primer/discussions/652#discussioncomment-2054579

@mperrotti
Copy link
Contributor Author

Filed in wrong repo

@mperrotti mperrotti closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant