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

[forms] Make <input type=button> magic clip not magic #9976

Closed
emilio opened this issue Dec 4, 2023 · 12 comments · Fixed by #9994
Closed

[forms] Make <input type=button> magic clip not magic #9976

emilio opened this issue Dec 4, 2023 · 12 comments · Fixed by #9994

Comments

@emilio
Copy link
Contributor

emilio commented Dec 4, 2023

What is the issue with the HTML Standard?

<input type=button> forces overflow: clip on their contents, but "magically".

I propose we remove that magic and instead add:

input:is([type=button], [type=reset], [type=submit]) {
  overflow: clip !important;
}

To the UA stylesheet in the spec here.

That would allow other features like text-overflow: ellipsis to also work, see https://bugzilla.mozilla.org/show_bug.cgi?id=1800077 / https://bugs.chromium.org/p/chromium/issues/detail?id=1383144.

@emilio emilio added topic: rendering topic: forms agenda+ To be discussed at a triage meeting labels Dec 4, 2023
@emilio
Copy link
Contributor Author

emilio commented Dec 4, 2023

cc @zcorpan

@zcorpan
Copy link
Member

zcorpan commented Dec 4, 2023

The current text says

https://html.spec.whatwg.org/#form-controls

For input elements where the type attribute is not in the Hidden state or the Image Button state, and that are being rendered, are expected to act as follows:

  • The inner display type is always 'flow-root'.
  • The 'overflow' property is ignored, and always behaves as 'visible' for the purpose of interaction with other CSS features (in particular, the 'vertical-align' property), but still clips any overflow at the border edge, and no scrolling mechanism is displayed.

Would vertical-align be affected by changing to 'clip'?

cc @whatwg/rendering

@emilio
Copy link
Contributor Author

emilio commented Dec 4, 2023

I don't think so, no.

@emilio
Copy link
Contributor Author

emilio commented Dec 4, 2023

And clearly given the bugs linked above the overflow property isn't completely ignored, either...

@zcorpan
Copy link
Member

zcorpan commented Dec 5, 2023

https://www.w3.org/TR/CSS22/visudet.html#propdef-vertical-align

The baseline of an 'inline-block' is the baseline of its last line box in the normal flow, unless it has either no in-flow line boxes or if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge.

My understanding is that if the computed value of 'overflow' is 'clip' then the baseline is the bottom margin edge, which isn't what we want for buttons (or form controls in general).

https://html.spec.whatwg.org/#form-controls has

input, button {
  display: inline-block;
}

Maybe the spec for vertical-align could be changed so that form controls are exempt from the baseline change based on 'overflow'?

@zcorpan
Copy link
Member

zcorpan commented Dec 5, 2023

Demo: https://software.hixie.ch/utilities/js/live-dom-viewer/saved/12199

It seems WebKit/Chromium/Gecko don't honor CSS 2.2 wrt the above-quoted text about where the baseline should be. (WebKit and Chromium also use the first line instead of the last line for multi-line buttons, but that's a separate issue.)

@emilio
Copy link
Contributor Author

emilio commented Dec 5, 2023

CSS2 is not the thing to follow here, see w3c/csswg-drafts#6212.

@zcorpan
Copy link
Member

zcorpan commented Dec 6, 2023

Ah, thanks! Then yes, I think switching to overflow: clip !important should work.

The only change to the suggested CSS in OP would be to use the i flag.

@emilio
Copy link
Contributor Author

emilio commented Dec 6, 2023

type is case insensitive in html elements iirc, but doesn't hurt to be explicit I guess

@past past removed the agenda+ To be discussed at a triage meeting label Dec 15, 2023
@mfreed7
Copy link
Contributor

mfreed7 commented Dec 15, 2023

This seems like a reasonable change to me. If I'm reading the comments correctly, changing to overflow: clip !important would seem to "just work" and would unblock other features like text-overflow.

emilio added a commit to emilio/html that referenced this issue Dec 15, 2023
zcorpan pushed a commit that referenced this issue Dec 18, 2023
The previous prose to make `overflow` act as `visible` with regards to other CSS features but still clip didn't work well with e.g. `text-overflow: ellipsis`. CSS now has a standard way to do what `input` buttons need, i.e. clip and also not affect interaction with `vertical-align`.

Fixes #9976.
rubberyuzu added a commit to rubberyuzu/html that referenced this issue Dec 21, 2023
Add pagereveal event

The pagereveal event is fired at the beginning of the first rendering opportunity after activation (initial load or reactivation). It is a way for the author to execute some JS that affects the presentation "just in time" for the first frame.

If there is an inbound cross-document view transition, the reveal event holds a reference to the ViewTransition object.

Closes whatwg#9315.

Use UA styles rather than prose to define <input> clip

The previous prose to make `overflow` act as `visible` with regards to other CSS features but still clip didn't work well with e.g. `text-overflow: ellipsis`. CSS now has a standard way to do what `input` buttons need, i.e. clip and also not affect interaction with `vertical-align`.

Fixes whatwg#9976.

Forbid nesting <details> in the same exclusive accordion

Fixes whatwg#9968.
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Dec 21, 2023
This implements the proposal in:

  whatwg/html#9976

Will wait till that is settled to land this.

MANUAL PUSH: See bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1800077
gecko-commit: 1fb09caf9d62bdc3b7449621fa8a8deb132a1070
gecko-reviewers: jwatt, zcorpan
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Dec 21, 2023
This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1800077
gecko-commit: 6a14f603289807a62753cc8ceaa35d9ba09cbf61
gecko-reviewers: jwatt, zcorpan
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Dec 22, 2023
…zcorpan

This implements the proposal in:

  whatwg/html#9976

Will wait till that is settled to land this.

MANUAL PUSH: See bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Dec 22, 2023
…zcorpan

This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Dec 22, 2023
This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1800077
gecko-commit: 6a14f603289807a62753cc8ceaa35d9ba09cbf61
gecko-reviewers: jwatt, zcorpan
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this issue Dec 22, 2023
…zcorpan

This implements the proposal in:

  whatwg/html#9976

Will wait till that is settled to land this.

MANUAL PUSH: See bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this issue Dec 22, 2023
…zcorpan

This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419
@josepharhar
Copy link
Contributor

josepharhar commented Dec 28, 2023

gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Jan 1, 2024
…zcorpan

This implements the proposal in:

  whatwg/html#9976

Will wait till that is settled to land this.

MANUAL PUSH: See bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

UltraBlame original commit: 1fb09caf9d62bdc3b7449621fa8a8deb132a1070
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Jan 1, 2024
…zcorpan

This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

UltraBlame original commit: 6a14f603289807a62753cc8ceaa35d9ba09cbf61
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Jan 1, 2024
…zcorpan

This implements the proposal in:

  whatwg/html#9976

Will wait till that is settled to land this.

MANUAL PUSH: See bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

UltraBlame original commit: 1fb09caf9d62bdc3b7449621fa8a8deb132a1070
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Jan 1, 2024
…zcorpan

This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

UltraBlame original commit: 6a14f603289807a62753cc8ceaa35d9ba09cbf61
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Jan 1, 2024
…zcorpan

This implements the proposal in:

  whatwg/html#9976

Will wait till that is settled to land this.

MANUAL PUSH: See bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

UltraBlame original commit: 1fb09caf9d62bdc3b7449621fa8a8deb132a1070
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Jan 1, 2024
…zcorpan

This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

UltraBlame original commit: 6a14f603289807a62753cc8ceaa35d9ba09cbf61
@MrHBS
Copy link

MrHBS commented Jan 15, 2024

I always thought <input type=“button”> was soft deprecated.

marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this issue Feb 23, 2024
This implements the proposal in: whatwg/html#9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1800077
gecko-commit: 6a14f603289807a62753cc8ceaa35d9ba09cbf61
gecko-reviewers: jwatt, zcorpan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

6 participants