Skip to content

select: How should we render <option label=label>text? #1115

Closed
@josepharhar

Description

@josepharhar

In the pre-customizable-select chromium implementation, option elements only render text content by manually collecting it from their descendants. If there is a label attribute, then the text cotent of descendant nodes is ignored and the text in the label attribute is rendered instead.

There is currently some code in chromium which tries to preserve this rendering behavior when not inside a customizable select, but doesn't do this label overwriting behavior and allows all child nodes to be rendered normally when inside a customizable select. It's not very performant right now and I'm currently trying to find ways to work around it.

It occurred to me that this has never been discussed before and could affect how I implement this - how should we render <option label=label>text</option>? Should "label" or "text" be rendered?

This would also affect cases like <option label=label><img src=...><span>text</span> more text</option> - if we choose to render "label", then the img and other child content would not be rendered.

If we don't render the label attribute, then should that label attribute be used in the accessibility tree instead of the actual child nodes? Is there a use case for that? @scottaohara

Related: #558

Metadata

Metadata

Assignees

No one assigned

    Labels

    selectThese are issues that relate to the select componentstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions