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

fix: Allow click events to pass through tooltip wrapped elements #1023

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export function Tooltip(props: TooltipProps) {
{...(!state.isOpen && typeof title === "string" ? { title } : {})}
{...tid}
// Add display contents to prevent the tooltip wrapping element from short-circuiting inherited styles (i.e. flex item positioning)
css={Css.display("contents").$}
// Once the element is `:active`, allow pointer events (i.e. click events) to pass through to the children.
css={Css.display("contents").addIn(":active", Css.add("pointerEvents", "none").$).$}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to write a test for this, but couldn't figure out how to get a click event to bubble up in tests. After 5-10minutes of searching and tryings out, I figured a manual test was good enough for now given the state of Beam soon being sunsetted.

// Adding `draggable` as a hack to allow focus to continue through this element and into its children.
// This is due to some code in React-Aria that prevents default due ot mobile browser inconsistencies,
// and the only way they don't prevent default is if the element is draggable.
Expand Down
Loading