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 onChange is not being triggered when e.target.value is the selected value #20698

Closed
2 tasks done
dana-playbuzz opened this issue Apr 22, 2020 · 1 comment
Closed
2 tasks done
Labels
component: select This is the name of the generic UI component, not the React module! out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future)

Comments

@dana-playbuzz
Copy link

Select component - onChange is not being triggered when e.target.value is the selected value

  • The issue is present in the latest release. (was working ok on 4.8.3).
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

onChange isn't being triggered in case the clicked menuItem is the selected one.

Expected Behavior 🤔

onChange should be triggered in that case

Steps to Reproduce 🕹

example - https://codesandbox.io/s/angry-volhard-lzssz?file=/src/App.js

Steps:

  1. change value of selected item from 'first' to 'second'
  2. log will be written to console
  3. open the menu and select 'second' again
  4. no log will be written to console - onChage won't be triggered.
  5. changing in package.json the "@material-ui/core" to "4.8.3" will fix this issue.

Context 🔦

I have a select of dates (one week, one month, etc & custom date). When selecting the custom date a date range picker is being opened and allow selecting specific date range. Now when I want to select another custom date, my selection doesn't trigger my date range picker.

Your Environment 🌎

Tech Version
Material-UI v4.9.11
React 16.13.1
Browser Chrome
@oliviertassinari oliviertassinari added component: select This is the name of the generic UI component, not the React module! out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future) labels Apr 22, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Apr 22, 2020

It's on purpose: #20361. Add a click listener on the menu item you are intereseted in.

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! out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future)
Projects
None yet
Development

No branches or pull requests

2 participants