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

Format and transition numbers #1668

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

oktaal
Copy link
Contributor

@oktaal oktaal commented Sep 27, 2024

Formats the hit count. Adds some transition effects. Borrowed from MiMA

showing the numbers

Comment on lines +3 to 10
<h2 class="subtitle">
{page.total, plural, =1 {1 result} other {{{page.total | transitionNumbers}} results}}
@if (page.total > 5) {
Showing results {{pageResults.from$ | async | transitionNumbers}}
-
{{(pageResults.to$ | async)}}
{{(pageResults.to$ | async | transitionNumbers)}}
}
</h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been meaning to make the hit count a live region - similar to how it's used on the download tab. I'm concerned that updating the numbers like this would spawn a barrage of updates in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the aria-live="polite" should be enough?

"aria-live="polite" indicates that the screen reader should wait until the user is idle before presenting updates to the user. This is the most commonly used value, as interrupting the user with "assertive" might interrupt their flow."

And there is also this interesting attribute aria-busy

Used in ARIA live regions, the global aria-busy state indicates an element is being modified and that assistive technologies may want to wait until the changes are complete before informing the user about the update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-live=polite basically means the message is queued and will be read the next time the screen reader is idle. But that's why I was worried this might queue a bunch of updates that are all read after one another.

But it looks like aria-busy would be the right solution here!

@lukavdplas
Copy link
Contributor

Btw, another question: could you use a media query to disable the animation with prefers-reduced motion?

This isn't strictly necessary, since this animation doesn't count as motion. However, some people (including myself) use the setting to just reduce the amount of animation on webpages.

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

Successfully merging this pull request may close these issues.

2 participants