Skip to content

Conversation

@enterayush
Copy link

@enterayush enterayush commented Jan 6, 2026

Improves keyboard accessibility in the PDF.js viewer toolbar by making tooltips appear when a button receives keyboard focus, not only on mouse hover. This helps keyboard-only users understand the purpose of toolbar buttons while navigating with Tab.

Changes

Added CSS to show tooltips on :focus in addition to :hover.

Behavior for mouse users remains unchanged.

Testing

Verified tooltips appear on focus via keyboard.

Verified hover tooltips still work normally.

Fixes #19156

Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

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

@calixteman I would imagine this also needs feedback from the UI/UX team; what you do think?

web/viewer.css Outdated
}
}
/* Show tooltips for keyboard users */
.toolbarButton:focus::after,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be put in the correct structure/nesting as the other toolbar button rules.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback — I’ve updated the tooltip rule to follow the existing toolbar button structure. Please let me know if any further adjustments are needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's just below .toolbarButton now, but it needs to be included inside the nested structure of .toolbarButton.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed — moved the tooltip focus/hover rules into the .toolbarButton nested structure. Thanks for pointing that out!

@calixteman
Copy link
Contributor

@calixteman I would imagine this also needs feedback from the UI/UX team; what you do think?

Yeah, we need to have a feedback from someone from the a11y team (I already asked here: #19156 (comment) but nothing). I pinged them on our internal chat.

Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

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

Once the comment is addressed please make sure it passes linting and squash the commits into one; see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits if you're not familiar with how that can be done.

@enterayush enterayush force-pushed the fix-focus-tooltips-a11y branch from 3af2d97 to 4cc83e0 Compare January 13, 2026 05:51
@enterayush enterayush force-pushed the fix-focus-tooltips-a11y branch from 4cc83e0 to 0f418b4 Compare January 13, 2026 05:53
@enterayush
Copy link
Author

Squashed the commits into one as requested. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: UI button tooltips unavailable to keyboard navigation users - make tooltip appear also via focus - Accessibility issue

3 participants