There seem to be no way for an InputAdornment to know if it's inside a focused Input or FormControl.
I followed the pattern in FormLabel to try to get muiFormControl from the context and then assigning a class when muiFormControl.focused is true.
context.muiFormControl is undefined
See example at: https://codesandbox.io/s/k2vl243823
I am trying to implement an adornment that's only visible when the Input is focused.
| Tech | Version |
|--------------|---------|
| Material-UI |1.0.0-beta.43 |
| React | 16.2.0 |
| browser | all|
| etc | |
@ErikDakoda context.muiFormControl is an implementation detail. Don't use it.
I would say that the best approach is the following:
<Input
onFocus={() => {
this.setState({
focused: true
});
}}
onBlur={() => {
this.setState({
focused: false
});
}}
endAdornment={<EndAdornment focused={this.state.focused} />}
/>