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

STCOM-1391 Tooltip - check for hover on tooltip content before closing the tooltip. #2411

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

JohnC-80
Copy link
Contributor

@JohnC-80 JohnC-80 commented Jan 2, 2025

According to WCAG, content that's available/visible on hover should remain visible when the content itself is hovered... mouse-readers everywhere unite!

Approach

Tooltip already uses timeouts to provide a brief gap between event listeners and state updates. This implementation added a timeout to hiding the tooltip where we only hide the tooltip if neither the trigger nor the tooltip element itself are hovered by the mouse (using matches(':hover')). The CSS of the tooltip class had to be affected to observe mouse events since they are all placed in the #OverlayContainer by default.

@JohnC-80 JohnC-80 requested a review from a team as a code owner January 2, 2025 20:49
Copy link

github-actions bot commented Jan 2, 2025

Bigtest Unit Test Results

    1 files  ±0      1 suites  ±0   15s ⏱️ ±0s
1 533 tests ±0  1 525 ✅ ±0  8 💤 ±0  0 ❌ ±0 
1 535 runs  ±0  1 527 ✅ ±0  8 💤 ±0  0 ❌ ±0 

Results for commit 8c14d68. ± Comparison against base commit 945b706.

♻️ This comment has been updated with latest results.

@JohnC-80 JohnC-80 changed the title Tooltip - check for hover on tooltip content before closing the tooltip. STCOM-1391 Tooltip - check for hover on tooltip content before closing the tooltip. Jan 2, 2025
@JohnC-80 JohnC-80 requested a review from a team January 3, 2025 14:28
@Dmytro-Melnyshyn Dmytro-Melnyshyn requested a review from a team January 6, 2025 09:42
Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

LGTM. There is a reason I only every type a11y 😆

lib/Tooltip/Tooltip.js Outdated Show resolved Hide resolved
Copy link

sonarqubecloud bot commented Jan 7, 2025

@JohnC-80 JohnC-80 merged commit f7e2775 into master Jan 7, 2025
15 checks passed
@JohnC-80 JohnC-80 deleted the STCOM-1391 branch January 7, 2025 20:40
github-actions bot pushed a commit that referenced this pull request Jan 7, 2025
…g the tooltip. (#2411)

According to
[WCAG](https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus), content
that's available/visible on hover should remain visible when the content
itself is hovered... mouse-readers everywhere unite!

### Approach
Tooltip already uses timeouts to provide a brief gap between event
listeners and state updates. This implementation added a timeout to
hiding the tooltip where we only hide the tooltip if neither the trigger
nor the tooltip element itself are hovered by the mouse (using
`matches(':hover')`). The CSS of the tooltip class had to be affected to
observe mouse events since they are all placed in the
`#OverlayContainer` by default.
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.

4 participants