Switching from select defaultValue
to option selected
.
This commit is contained in:
parent
6288a02b50
commit
4ba197354e
1 changed files with 20 additions and 10 deletions
|
@ -32,9 +32,18 @@ const Select = ({
|
|||
data-testid={"select" + (testId ? "-" + testId : "")}
|
||||
onChange={(e) => update(items, onChange, e)}
|
||||
className={className}
|
||||
defaultValue={current}
|
||||
>
|
||||
{items.map(({ label, value }, index) => (
|
||||
{items.map(({ label, value }, index) => {
|
||||
if (label === current) {(
|
||||
<option
|
||||
data-testid={"option-" + (testId ? testId + "-" : "") + index}
|
||||
key={[label, index].join("")}
|
||||
value={value.toString()}
|
||||
selected
|
||||
>
|
||||
{label}
|
||||
</option>
|
||||
)} else {(
|
||||
<option
|
||||
data-testid={"option-" + (testId ? testId + "-" : "") + index}
|
||||
key={[label, index].join("")}
|
||||
|
@ -42,7 +51,8 @@ const Select = ({
|
|||
>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
)}
|
||||
})}
|
||||
</select>
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue