Skip to content

select: Naming of <selectedoption> #1112

Closed

Description

@jakearchibald

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:

const selectedOption = select.selectedOptions[0];
const selectedOption = select.querySelector('selectedoption');

Activity

  1. lukewarlow commented on Oct 18, 2024

    @lukewarlow
    Collaborator

    For context here's the original discussion on naming: #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?

  2. jakearchibald commented on Oct 18, 2024

    @jakearchibald
    ContributorAuthor

    <selectedcontent> is the best I've got.

  3. brucelawson commented on Oct 18, 2024

    @brucelawson
  4. added
    selectThese are issues that relate to the select component
    on Oct 18, 2024
  5. smhigley commented on Oct 21, 2024

    @smhigley
    Collaborator

    <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.

  6. jakearchibald commented on Oct 22, 2024

    @jakearchibald
    ContributorAuthor

    I've seen a few folks that think <selectedoption> is a replacement for <option selected>, which is totally understandable.

  7. added
    agenda+Use this label if you'd like the topic to be added to the meeting agenda
    on Oct 24, 2024
  8. josepharhar commented on Oct 24, 2024

    @josepharhar
    Collaborator

    I agree, <selectedoption> verbally conflates with "selected <option>" really badly. <selectedcontent> sounds good to me.

  9. sorvell commented on Oct 25, 2024

    @sorvell

    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.

  10. jakearchibald commented on Oct 28, 2024

    @jakearchibald
    ContributorAuthor

    That feels like a pretty big semantic switch.

  11. sorvell commented on Oct 28, 2024

    @sorvell

    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:

    1. Is distinct from other select-related terms
    2. Clearly represents its purpose
    3. Is short and simple
    4. Isn't easily confused with existing properties
    5. Makes semantic sense in the context
  12. josepharhar commented on Oct 31, 2024

    @josepharhar
    Collaborator

    Here is our previous thread on naming, where we renamed it from <selectedvalue> to <selectedoption>: #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.

  13. brechtDR commented on Oct 31, 2024

    @brechtDR
    Collaborator

    +1 on slectedcontent

  14. css-meeting-bot commented on Oct 31, 2024

    @css-meeting-bot

    The Open UI Community Group just discussed select: Naming of <selectedoption>, and agreed to the following:

    • RESOLVED: rename the selectedoption element to selectedcontent
    The full IRC log of that discussion <frehner> Hoping to gain enough context in the next couple of sessions to start scribing :)
    <gregwhitworth> jarhar: selectedcontent will be the new name for selectedoption
    <gregwhitworth> masonf: the name is confusing currently and my initial position and in programming it can be confusing. Using it as your first option in select and "oops it didn't work"
    <gregwhitworth> q+
    <gregwhitworth> ack gregwhitworth
    <gregwhitworth> steve: Jake voted for selectedcontent as well
    <gregwhitworth> steve: to level set this is not a final solution
    <gregwhitworth> masonf: we don't make final decisions here but make recommendations
    <masonf> q+
    <gregwhitworth> steve: only issue is that the name is verbose and long and it seems odd that the parent element is the name
    <gregwhitworth> steve: I do agree with Jake that it is quite confusing and only concern is it is long
    <gregwhitworth> steve: it solves the primary problem
    <gregwhitworth> masonf: it is selected and not select so it is slight variation. This is clear that it is just the content and not the option
    <jarhar> q?
    <masonf> ack mason
    <gregwhitworth> ack masonf
    <bkardell_> the output paradigm would be more useful if anyone outside this chat knew about <output> ;)
    <masonf> <output> is form associated, which adds even more stuff to deal with
    <jarhar> proposed resolution: rename the selectedoption element to selectedcontent
    <masonf> +1
    <bkardell_> +1
    <gregwhitworth> +1
    <sarah> +1
    <scott> +1
    <jarhar> RESOLVED: rename the selectedoption element to selectedcontent
  15. removed
    agenda+Use this label if you'd like the topic to be added to the meeting agenda
    on Nov 6, 2024
  16. added a commit that references this issue on Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    selectThese are issues that relate to the select component

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions