svelte-material-ui
svelte-material-ui copied to clipboard
<Select> on:change does not work
Describe the bug on:change never called when new value is selected
To Reproduce
<Select variant='outlined' bind:value={editedUser.currentProject} on:change={() => console.log('change called')} label='Proyek'>
<Option value='name 1'>name 1</Option>
<Option value='name 2'>name 2</Option>
</Select>
Expected behavior on:change triggered and console.log() should be called
Desktop (please complete the following information):
- OS: Pop OS! 21.04
- Browser Brave
- Version 1.30.89 Chromium: 94.0.4606.81 (Official Build) (64-bit)
Use on:MDCSelect:change instead on:change, and it will work.
https://github.com/material-components/material-components-web/tree/v11.0.0/packages/mdc-select#events
Yes, the Select component doesn't actually use a native input element, so it doesn't fire a change event.
I'll leave this open to track properly documenting this.
Please make it work the same as native HTML <select> with Svelte. Most of us read docs only when something does not work. Making it work with on:change would save time each time the feature is needed by any developer.