-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
[TextField] Fix to handle onClick
on root element
#38072
[TextField] Fix to handle onClick
on root element
#38072
Conversation
Netlify deploy previewhttps://deploy-preview-38072--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
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.
I think the root problem is with #36892 (comment).
This reverts commit 113429c.
This reverts commit 113429c.
While this PR aims to fix a regression, I think it introduces another one, see https://codesandbox.io/s/suspicious-kirch-7wfhxw?file=/Demo.tsx import * as React from "react";
import Box from "@mui/material/Box";
import TextField from "@mui/material/TextField";
export default function BasicTextFields() {
return (
<Box
onClick={() => {
console.log("Foo");
}}
>
<TextField
onClick={() => {
console.log("textField");
}}
/>
</Box>
);
}
|
This reverts commit 113429c.
This reverts commit 113429c.
#36892 changed the
onClick
handling behavior on theTextField
component.Previously the callback used to be registered on the root element and pickers relied on it (mui/mui-x#6074) to correctly handle click -> open behavior regardless of where the click has been done.
Now we have a regression mui/mui-x#9386 on the mentioned behavior because the fix has basically been negated.
Closes mui/mui-x#9386
If you have any better suggestions on how to solve this conundrum—I'm open to suggestions.
We have considered and tried using
onMouseDown
, but it has its drawbacks and interferes with other component behavior.One other easy fix would be to remove the
z-index: 1
on the label and figure out another way to achieve the same fix.