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

[MDCSelect] Setting value causes change event to be fired twice #5570

Closed
Malloreon opened this issue Feb 6, 2020 · 4 comments · Fixed by #5659
Closed

[MDCSelect] Setting value causes change event to be fired twice #5570

Malloreon opened this issue Feb 6, 2020 · 4 comments · Fixed by #5659
Assignees
Labels

Comments

@Malloreon
Copy link

Bug report

Setting the selected option of an MDCSelect element by setting the value causes the change event to be fired twice.

Steps to reproduce

  1. Initialize an MDCSelect element
  2. Listen to the MDCSelect:change event
  3. Set the MDCSelect value through Javascript

Actual behavior

The change event is fired twice.

Expected behavior

The change event should only be fired once.

Your Environment:

Software Version(s)
MDC Web Latest
Browser Chrome
Operating System Windows 10

Additional context

I've created a JSFiddle showing the issue here:
https://jsfiddle.net/1q09hsc2/7/

@Malloreon Malloreon added the bug label Feb 6, 2020
@allan-chen
Copy link
Collaborator

Hi - Thanks for reaching out. I was able to reproduce this on the given fiddle. It seems like in the foundation code, handleChange() is called both in setSelectedIndex() and setValue(), which calls setSelectedIndex()

copybara-service bot pushed a commit that referenced this issue Feb 26, 2020
Previously `handleChange()` was called both in `setSelectedIndex()` and in `setValue()` which calls `setSelectedIndex()`.
Closes #5570

PiperOrigin-RevId: 297416198
copybara-service bot pushed a commit that referenced this issue Feb 26, 2020
Previously `handleChange()` was called both in `setSelectedIndex()` and in `setValue()` which calls `setSelectedIndex()`.
Closes #5570

PiperOrigin-RevId: 297416198
copybara-service bot pushed a commit that referenced this issue Feb 26, 2020
Previously `handleChange()` was called both in `setSelectedIndex()` and in `setValue()` which calls `setSelectedIndex()`.
Closes #5570

PiperOrigin-RevId: 297416198
@allan-chen allan-chen assigned allan-chen and unassigned bonniezhou Feb 26, 2020
@brycekirk
Copy link

This still appears to be an issue in the 5.1.0 release

@allan-chen
Copy link
Collaborator

Looks like this missed the 5.1.0 release by a day - should be out next release

@lafonju
Copy link

lafonju commented Mar 30, 2020

@allan-chen Do you know when the next version will be available via NPM to take advantage of the correction ?
Thanks you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants