Open jakearchibald opened 1 month ago
For context here's the original discussion on naming: https://github.com/openui/open-ui/issues/808
There were a few proposals. I liked value or selectedvalue but it was pointed out that's not quite right because it's not actually the value. selected is perhaps too ambiguous?
There's no prior art from which to base the naming off unfortunately.
Potentially worth considering what might the element look like for select multiple in future?
<selectedcontent>
is the best I've got.
<selection>
feels a little close to text selection to me 😅
I kinda like <selectedcontent>
in that it makes it a little more intuitive that it's a semantically generic container mirroring the content of the selected option, and not literally a semantic option nested inside the button.
I've seen a few folks that think <selectedoption>
is a replacement for <option selected>
, which is totally understandable.
I agree, <selectedoption>
verbally conflates with "selected <option>
" really badly. <selectedcontent>
sounds good to me.
What about repurposing the <output>
element for this?
It probably doesn't work, but it seems at least conceptually similar since it's primarily displaying the result of a user action.
That feels like a pretty big semantic switch.
claude.ai thinks choice
is the strongest option:
<select>
<button>
<choice>Apple</choice> <!-- automatically updates when selection changes -->
</button>
<option value="apple">Apple</option>
<option value="banana">Banana</option>
</select>
choice
works well because it:
Here is our previous thread on naming, where we renamed it from <selectedvalue>
to <selectedoption>
: https://github.com/openui/open-ui/issues/808
I'd rather not use <output>
for this since it already has semantics/behaviors.
I like <selectedcontent>
because it represents the content of the currently selected option. <choice>
sounds a bit vague by comparison.
+1 on slectedcontent
The Open UI Community Group just discussed select: Naming of <selectedoption>
, and agreed to the following:
RESOLVED: rename the selectedoption element to selectedcontent
Sorry, I know bikeshedding is painful, but it's really awkward that "the
<selectedoption>
" and "the selected<option>
" are different things, even though they sound the same verbally.Try saying "the
<selectedoption>
contains a clone of the content of the selected<option>
" out loud. You need to say something like "the<selectedoption>
contains a clone of the content of the<option>
that is selected" to make it understandable, but that also sounds weird.It's a problem in code too: