Skip to content

[dev-overlay] Expand clickable area for Select component in user preferences #80300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

teamleaderleo
Copy link
Contributor

@teamleaderleo teamleaderleo commented Jun 8, 2025

The Select component in the User Preferences panel had a clickable area limited to the text of the selected option, not the entire visible button area. This made the component feel unresponsive.

We fixed it with some spans and css stuff. Also, the dropdown options are now full-width, which I feel like is an upgrade, due to improved visual consistency. See material design as an example of the full-width selection options:
image

fixes #80299

What we did to make it clickable:

  1. Made select cover the space of its parent container with position: absolute; inset: 0;, then opacity: 0; so there's no duplicate select text, and cursor: pointer; so that the cursor changes to reflect the element's clickability.
  2. Added custom spans to display the text, since we made select invisible.
  3. Added a second span acting as a strut to have a max width (otherwise the button sizing becomes dynamic), putting them in a div wrapper with display: grid;, then targeting the spans themselves with grid-area: 1 / 1; so they overlap, then setting the span:first-child (longest element) with visibility: hidden; so we don't get duplicated text.

After:

fixed click

Before:

before fixed click

Why we decided against align-items: center; justify-content: flex-start; and just went with the programmatic spans:

We'd have to hardcode a bunch of separate padding.
image

Why we need the spans and not just the select:

Only adjusting the positions on select takes it out of the document's layout flow. The parent div (.select-button) would then calculate its width based on its remaining in-flow children (the icon and the chevron), causing it to shrink and ignore the space needed for the text.
image

This is a partial continuation of #80025 (dark mode for options), but this change felt separate and extensive enough to warrant its own PR.

The clickable area was limited to the text of the selected option, not the entire visible button area. This made the component feel unresponsive.

I was unable to directly stretch the select element to expand its clickable area, and so added a span.

Initially, an unintended side effect of the change caused the button's width to change dynamically with the selection, losing the stable width behavior of the original select element.

To restore this, a hidden `<span>` sets a consistent width based on the longest option.
@ijjk ijjk added the type: next label Jun 8, 2025
@ijjk
Copy link
Member

ijjk commented Jun 8, 2025

Allow CI Workflow Run

  • approve CI run for commit: 133d573

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dev-overlay] User Preferences <select> buttons only clickable on text, not entire button
2 participants