-
-
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
No way to get ref to root of <Input> in a <TextField> #12471
Comments
@dantman have you tried |
@jedwards1211 Yeah, it works. It'll be using that as a workaround for now. But it should be possible to do this without the discouraged findDOMNode. And with the same ease of use as |
@jedwards1211 Yes, it's the encouraging approach to solve the issue until React proposes a better solution. #10825 Won't help for this issue as it targets higher-order components, exposing a |
Other MUI components already have an equivalent. e.g. ButtonBase has a And I doubt that React is going to propose an alternative. Adding |
@dantman We do provide a |
Another way to do it which is questionable but avoids findDOMNode: |
RootRef is just findDOMNode in disguise. And it doesn't work in this use case because |
@dantman for advanced use cases, I encourage people to break the TextField abstraction. You can use the lower level components. |
Expected Behaviour
<Input>
outputs a<div>
root that wraps the accents and the input. It should be possible to attach a ref to this input. And it should be possible to do this from a<TextField />
.Current Behaviour
Input only passes
{...other}
to the<div>
Context
I needed to attach a Popper based menu to the bottom of a TextField, but I need it to open lined up with the whole
<Input>
, not the<input>
(then it's inset by the inputAdornment) and not the<FormControl>
(then when the menu is above the input it will appear above the label instead of overlapping the label).The text was updated successfully, but these errors were encountered: