Ramonda

option-that-cannot-choose

This fails the run. Where it is wrong about your code, // ramonda-check-ignore <reason> on the line says so, and the reason is printed on every run.

Reported when selected is written on an <option> inside a <Select>, which sets it from value instead.

Select decides the choice, and it does it by walking EVERY option and setting each one on or off from its value. An option that asked to be chosen is turned off again a moment later. The attribute is not competing with value — it does nothing.

Say which one is chosen where the component already asks:

<Select value={chosen} aria-label="Size">
  <option value="s">Small</option>
  <option value="m">Medium</option>
</Select>

For an initial choice, that is what the state behind value starts as. For several, value takes an array and the select is multiple.

This is the fault the refused <select> tag could not reach. The tag is refused because HTML settles competing selected claims by keeping the LAST one, and gives a select with no claim its first option — so the same markup meant different things depending on the order the options reached it, and that is not an order anybody writes. <Select value={x}> settles it once they all exist; the option's own attribute is the one line that still looks like it chooses.

Next