-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
[SelectField] currentTarget no longer works #5085
Comments
+1 |
This is occurring again in The reason I default to using The Material-ui docs say to use I'm not sure if anyone will see this comment, so I'll wait a few days before I make a new issue. Thank you. |
@wbstow In practice, you would like to see this diff land? diff --git a/packages/material-ui/src/Select/SelectInput.js b/packages/material-ui/src/Select/SelectInput.js
index 9b42a632c..6b39ab47c 100644
--- a/packages/material-ui/src/Select/SelectInput.js
+++ b/packages/material-ui/src/Select/SelectInput.js
@@ -127,6 +127,7 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
event.persist();
event.target = { value: newValue, name };
+ event.currentTarget = event.target;
onChange(event, child);
}
}; |
@oliviertassinari It's up to you - with
I am not sure if this wasn't a breaking change because I could swear that my Select was working before I updated to Thank you. |
If you're trying to keep the signalling of the I corrected my last comment: |
Sorry - one more correction: With |
I don't think that we change it, event.target should be preferred. |
OK, I had standardized on using Whatever you decide is fine with me, just pointing it out. Thanks!! |
To make my Selects work, I simply created a different version of my export function useInputTargetValue(defaultValue = "") {
const [value, setValue] = React.useState(defaultValue);
/** @param {React.SyntheticEvent<HTMLInputElement>} e */
function onChange(e) {
setValue(e.target.value);
}
return [value, onChange, setValue];
} |
Prior to 0.15.4 I was able to capture custom data from the selected menu items with event.currentTarget.dataset. Now event.currentTarget returns null onChange
Example:
The text was updated successfully, but these errors were encountered: