-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] When wrapping an input which is disabled while focused an error is thrown #45373
Comments
Hi @DavidJohnWilliams, following your steps I can not reproduce this behavior |
@lukamandic Hmmm, I'm not really sure why? You need to click in the input once the sandbox loads (before the input is disabled), then wait. That's it. If it is disabled too fast for you, increase the timeout or refresh the preview. 20250220-2346-39.9438120.mp4 |
I can reproduce the issue. I think this is a bug. |
I will work on this |
Quickly tried something like this should work: diff --git a/packages/mui-material/src/Tooltip/Tooltip.js b/packages/mui-material/src/Tooltip/Tooltip.js
index c7479ac521..b1129eb799 100644
--- a/packages/mui-material/src/Tooltip/Tooltip.js
+++ b/packages/mui-material/src/Tooltip/Tooltip.js
@@ -478,8 +478,8 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) {
const [, setChildIsFocusVisible] = React.useState(false);
const handleBlur = (event) => {
- if (!isFocusVisible(event.target)) {
- setChildIsFocusVisible(false);
+ setChildIsFocusVisible(false);
+ if (event && !isFocusVisible(event.target)) {
handleMouseLeave(event);
}
}; @sarathkumarsasi I've assigned you ~ |
… while focused an error is thrown mui#45373 Signed-off-by: Sarathkumar <[email protected]>
@sarathkumarsasi If it's not directly related to the issue, I would suggest leaving it alone 🤔 |
… while focused an error is thrown mui#45373 Signed-off-by: Sarathkumar <[email protected]>
… while focused an error is thrown mui#45373 Fixed linting issue. Signed-off-by: Sarathkumar <[email protected]>
Steps to reproduce
Steps:
Current behavior
A Javascript error is thrown
Expected behavior
The input should be disabled as usual
Context
Input
has auseEffect
which callsonBlur
without an event. This is sort of documented i.e. a comment on theonBlur
ofInput
however theTooltip
does not take account of this and tries to accessevent.target
.Your environment
It happens in any browser
Search keywords: tooltip target
The text was updated successfully, but these errors were encountered: