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

Tooltip: handle non-interactive tooltip triggers #130

Merged
merged 8 commits into from
Dec 6, 2023

Conversation

kerryarchibald
Copy link
Contributor

@kerryarchibald kerryarchibald commented Nov 19, 2023

Fixes element-hq/compound#280
For element-hq/compound#248

Radix tooltip needs trigger elements to receive pointer events to hide/show tooltip correctly on mouseover
Trigger elements must also receive focus to open on focus.

This PR adds the optional property isTriggerInteractive, and wraps uninteractive triggers with a focusable span, as recommended by radix. The most common pattern for tooltips is use on interactive elements (icon buttons) so isTriggerInteractive defaults to true.

Screen.Recording.2023-11-20.at.15.18.48.mov

Also sets delay according to trigger interactivity, as described in element-hq/compound#280

@kerryarchibald kerryarchibald requested a review from a team as a code owner November 19, 2023 22:45
@kerryarchibald kerryarchibald requested review from dbkr and robintown and removed request for a team November 19, 2023 22:45
@kerryarchibald kerryarchibald added the enhancement New feature or request label Nov 19, 2023
Copy link

cloudflare-workers-and-pages bot commented Nov 19, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9f2f6d5
Status: ✅  Deploy successful!
Preview URL: https://14a2c810.compound-web.pages.dev
Branch Preview URL: https://kerry-280-tooltip-delay.compound-web.pages.dev

View logs

@kerryarchibald kerryarchibald changed the title Tooltip: apply delay when trigger is interactive Tooltip: handle non-interactive tooltip triggers Nov 20, 2023
Copy link
Member

@robintown robintown left a comment

Choose a reason for hiding this comment

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

I just have the same comment as Michael

@robintown robintown removed the request for review from dbkr November 20, 2023 17:43
Copy link
Member

@robintown robintown left a comment

Choose a reason for hiding this comment

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

Looks good, just minor comments

src/components/Tooltip/Tooltip.tsx Outdated Show resolved Hide resolved
src/components/Tooltip/Tooltip.test.tsx Outdated Show resolved Hide resolved
@robintown robintown removed the request for review from t3chguy November 29, 2023 02:52
@robintown robintown merged commit be8822e into main Dec 6, 2023
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Correct tooltip delay
3 participants