Commit 11be5bf
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 11be5bf
1 file changed
Lines changed: 10 additions & 5 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 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | | - | |
| 49 | + | |
45 | 50 | | |
46 | | - | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| |||
0 commit comments