Skip to content

refactor(tooltip): only show tooltip on focus if :focus-visible matches#1517

Merged
spike-rabbit merged 1 commit intomainfrom
refactor/tooltip/only-show-on-focus-visible
Feb 13, 2026
Merged

refactor(tooltip): only show tooltip on focus if :focus-visible matches#1517
spike-rabbit merged 1 commit intomainfrom
refactor/tooltip/only-show-on-focus-visible

Conversation

@spike-rabbit
Copy link
Member

@spike-rabbit spike-rabbit commented Feb 12, 2026

Currently, the tooltip is always shown
if the attached element receives focus.
This behavior is not desired.
This previously also showed the tooltip
if Element was programmatically focussing an element. For instance in the navbar after closing a flyout menu.

With the new logic, a tooltip will only be shown on focus if the :focus-visible selector matches and thus the site is operated by a keyboard.

This commit is labeled as a refactor,
as the new behavior was introduced within the same release.

Describe in detail what your merge request does and why. Add relevant
screenshots and reference related issues via Closes #XY or Related to #XY.


Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the tooltip to only appear on keyboard focus by checking for :focus-visible, which is a great enhancement for accessibility and user experience. The implementation is mostly correct and is well-tested with a new end-to-end test.

I've found one potential issue in the tooltip directive related to server-side rendering (SSR). The current logic could cause errors on the server because it attempts to render a tooltip in a non-browser environment. I've left a specific comment with a suggested fix for this.

Otherwise, the changes look good and the new test provides good coverage for the new behavior.

@spike-rabbit spike-rabbit force-pushed the refactor/tooltip/only-show-on-focus-visible branch 2 times, most recently from 9bec8c0 to 4c3cfec Compare February 13, 2026 10:16
@spike-rabbit spike-rabbit marked this pull request as ready for review February 13, 2026 10:32
@spike-rabbit spike-rabbit requested review from a team as code owners February 13, 2026 10:32
@github-actions
Copy link

Copy link
Member

@dauriamarco dauriamarco left a comment

Choose a reason for hiding this comment

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

LGTM 👍 and I guess that I can also close #1514 as this one is a better solution, especially if we don't need to show the tooltip on programmatic focus.

…ches

Currently, the tooltip is always shown,
if the attached element receives focus.
This behavior is not desired,
as this previously also showed the tooltip
if Element was programmatically focussing an element.
For instance in the navbar after closing a flyout menu.

With the new logic, a tooltip will only be shown on focus
if the `:focus-visible` selector matches and thus the site
is operated by a keyboard.

This commit is labeled as a refactor,
as the new behavior was introduced within the same release.
@spike-rabbit spike-rabbit force-pushed the refactor/tooltip/only-show-on-focus-visible branch from 4c3cfec to 4a238f4 Compare February 13, 2026 16:07
@spike-rabbit spike-rabbit enabled auto-merge (rebase) February 13, 2026 16:07
@github-actions
Copy link

Code Coverage

@spike-rabbit spike-rabbit merged commit 1e65839 into main Feb 13, 2026
10 checks passed
@spike-rabbit spike-rabbit deleted the refactor/tooltip/only-show-on-focus-visible branch February 13, 2026 16:21
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