Skip to content

Commit

Permalink
fix(select): set hidden input value before firing change event
Browse files Browse the repository at this point in the history
closes #6904

PiperOrigin-RevId: 361659771
  • Loading branch information
allan-chen authored and Copybara-Service committed Mar 8, 2021
1 parent f77a4dd commit 2d6ba2c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/mdc-select/component.ts
Expand Up @@ -456,12 +456,13 @@ export class MDCSelect extends MDCComponent<MDCSelectFoundation> {
this.lineRipple && this.lineRipple.deactivate();
},
notifyChange: (value: string) => {
const index = this.selectedIndex;
this.emit<MDCSelectEventDetail>(strings.CHANGE_EVENT, {value, index}, true /* shouldBubble */);

if (this.hiddenInput) {
this.hiddenInput.value = value;
}

const index = this.selectedIndex;
this.emit<MDCSelectEventDetail>(
strings.CHANGE_EVENT, {value, index}, true /* shouldBubble */);
},
};
// tslint:enable:object-literal-sort-keys
Expand Down

0 comments on commit 2d6ba2c

Please sign in to comment.