-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Fix children mouse over detection #32321
[Tooltip] Fix children mouse over detection #32321
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be working well. Thanks, @ivan-ngchakming!
Do we miss a test case for this bug fix? |
@ivan-ngchakming would you mind adding a test? |
3a7af87
to
18ffb5f
Compare
I added a test. @michaldudak |
I wonder if we don't have two problems with these changes, It's not clear to me that it's a step forward (might be better without):
So what I would propose is to:
interface AirbnbThumbComponentProps extends React.HTMLAttributes<unknown> {}
-function AirbnbThumbComponent(props: AirbnbThumbComponentProps) {
- const { children, ...other } = props;
- return (
- <SliderThumb {...other}>
- {children}
- <span className="airbnb-bar" />
- <span className="airbnb-bar" />
- <span className="airbnb-bar" />
- </SliderThumb>
- );
-}
+const AirbnbThumbComponent = React.forwardRef(
+ (props: AirbnbThumbComponentProps, ref) => {
+ const { children, ...other } = props;
+ return (
+ <SliderThumb {...other} ref={ref}>
+ {children}
+ <span className="airbnb-bar" />
+ <span className="airbnb-bar" />
+ <span className="airbnb-bar" />
+ </SliderThumb>
+ );
+ }
+);
export default function CustomizedSlider() {
return (
The alternative is to go a bit above and beyond:
What do you think about it? cc @hbjORbj @michaldudak (as co-owners of the tooltip) |
This reverts commit dc0e387bcdd6b4654f5e7fb472e6fba18c582deet . See #32321 (comment) for why.
I have reverted this PR and moved the conversation to the issue: #31198 (comment). |
This reverts commit dc0e387bcdd6b4654f5e7fb472e6fba18c582deet . See mui#32321 (comment) for why.
I believe this bug is also caused by facebook/react#7769, where
Ref
effects are called afterUpdate
, thereforechildNode
(set by ref passed to child) is undefined. The issue is fixed foronFocus
events in #14496, this PR applies the same fix foronMouseOver
events.fixes #31198