Skip to content
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

[css-ui] Clarify why user-select: none should be the default for button, meter, progress, select #9709

Open
dizhang168 opened this issue Dec 14, 2023 · 3 comments
Labels
css-ui-4 Current Work

Comments

@dizhang168
Copy link
Member

The spec [1] was changed by commit [2]:

The following additions are made to the UA stylesheet for HTML:

button, meter, progress, select { user-select: none; }

However, there is no mention of how that decision was made (why this list of elements specifically?).
Note also that this is currently not specced in the HTML standard [3].

[1] https://drafts.csswg.org/css-ui/#issue-5d851d49
[2] 1c0b6c9
[3] whatwg/html#8228

@josepharhar
Copy link
Contributor

@frivoal can you help us figure out the rationale for button { user-select: none; } which blink and webkit don't currently implement?

@frivoal frivoal added the css-ui-4 Current Work label Dec 15, 2023
@frivoal
Copy link
Collaborator

frivoal commented Dec 15, 2023

It's been a while, but as far as I can remember, this came from trying to spec what browsers did at the time, more than a principled decision.

@lukewarlow
Copy link
Member

lukewarlow commented Apr 7, 2024

I came across the discrepency between browsers with these styles the other day. I think it would be good to standardise and make the UA stylesheet interopable in this regard.

Gecko's relevant UA styles below (there's other properties in the selectors but this is what's relevant):

button,
::file-selector-button,
input:is([type=color], [type=reset], [type=button], [type=submit]) {
  user-select: none;
}

select {
  user-select: none;
}

Gecko has user-select of auto for meter and progress.

Blink relevant stylesheet rules:

input[type="button"] {
    user-select: none;
}

input[type="reset"] {
    user-select: none;
}

input[type="submit"] {
    user-select: none;
}

Blink has user-select of auto for (proper) buttons, and select as well as meter and progress.

WebKit has -webkit-user-select of text for input buttons*, (proper) buttons, and select as well as meter and progress.

  • Though the CSS says text select should work in practice it actually doesn't. So observed behaviour is the same for input buttons in all browsers (no text selection).

There's an inline issue regarding button like variants of input.

Given Firefox's UA stylesheet includes these if the spec is going to include this rule I think it should include ::file-selector-button and input:is([type=reset], [type=button], [type=submit]) in the list.

Though I'm dubious of the utility of including color input, it's button like but it doesn't contain text content and can't be meaningfully selected anyway? Maybe include it for consistency with other button like UI?


I'm also dubious of the utility of including meter and progress in this rule, when they're not button like, and don't contain text to select? They're also not user-select: none in any of the current major browser engines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-ui-4 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants