Commit de12ba0
User
Fix #270: Use value instead of defaultValue on <select> for Preact compat
Preact treats defaultValue as a plain HTML attribute and does not
apply it to the DOM value property on <select> elements. Use
value instead — Preact has special handling that applies value
after <option> children have been reconciled, which correctly
restores the selection on form re-render.
Retain selected on <option> elements as a secondary cue so that
even if Preact reconciles children in-place (updating rather than
replacing), the <option> nodes carry the correct selection hint.1 parent 5d4e674 commit de12ba0
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
0 commit comments