Skip to content
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

[Select] triggered onBlur event.target element is the selected option #10534

Closed
1 task done
galki opened this issue Mar 5, 2018 · 2 comments
Closed
1 task done

[Select] triggered onBlur event.target element is the selected option #10534

galki opened this issue Mar 5, 2018 · 2 comments
Labels
component: select This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@galki
Copy link

galki commented Mar 5, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Setting onBlur event on a select TextField I expect the triggered onBlur event.target to be the TextField.

Current Behavior

It is the selected option (or MenuItem) element.

Context

I'm abstracting away form validation and submission. I use both onChange and onBlur event.target to get the value and name attributes of that element. Since onBlur event.target name is now undefined I get it from the props.

Your Environment

Tech Version
Material-UI beta35
React 16.2.0
browser Chrome 64
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 5, 2018

@galki Do you have a live reproduction example?

@oliviertassinari oliviertassinari added component: select This is the name of the generic UI component, not the React module! waiting for user information labels Mar 5, 2018
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 5, 2018

I expect the triggered onBlur event.target to be the TextField.

@galki Please mind the difference between event.target and event.currentTarget:

  • target is whatever you actually clicked on. It can vary, as this can be within an element that the event was bound to.
  • currentTarget is the element you actually bound the event to. This will never change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

2 participants