Skip to content

[forms] Remove anonymous button content-box, and use CSS rather than magic for input / button block axis centering. - #12781

Open
emilio wants to merge 1 commit into
whatwg:mainfrom
emilio:button-input-align-content
Open

[forms] Remove anonymous button content-box, and use CSS rather than magic for input / button block axis centering.#12781
emilio wants to merge 1 commit into
whatwg:mainfrom
emilio:button-input-align-content

Conversation

@emilio

@emilio emilio commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This defines the (previously undefined, afaict) unsafe center alignment of text inputs and textarea, and makes the changes discussed by the CSS Working Group in w3c/csswg-drafts#14190.

(See WHATWG Working Mode: Changes for more details.)


/rendering.html ( diff )

@emilio
emilio requested review from annevk and zcorpan August 12, 2026 15:54
@emilio

emilio commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@zcorpan / @annevk the thing I'm not sure about how to best define is the select:not(:listbox) thing. Any pointers?

@josepharhar

Copy link
Copy Markdown
Contributor

the thing I'm not sure about how to best define is the select:not(:listbox) thing. Any pointers?

Since adding a pseudo-class for listbox vs dropdown select elements didn't work out, we just reference the drop-down box definition explicitly with prose like this example in the rendering section:

The following styles are expected to apply to select elements when they are being rendered as a drop-down box with native appearance or primitive appearance:

@namespace "http://www.w3.org/1999/xhtml";

select {
  display: inline-block;
}

@emilio

emilio commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

The following styles are expected to apply to select elements when they are being rendered as a drop-down box with native appearance or primitive appearance:

@namespace "http://www.w3.org/1999/xhtml";

select {
  display: inline-block;
}

I did this but trimmed out the appearance thing since I think this should apply regardless of appearance probably, see w3c/csswg-drafts#14319.

If you object to that I'm happy to reintroduce it tho.

…magic for input / button / select block axis centering.

This defines the (previously undefined, afaict) unsafe center alignment
of text inputs and textarea, and makes the changes discussed by the CSS
Working Group in w3c/csswg-drafts#14190.
@emilio
emilio force-pushed the button-input-align-content branch from aeae1a5 to ed3addd Compare August 16, 2026 11:15
@emilio

emilio commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Ah, actually for base appearance it would be a no-op (by default) because that's a flex container with flex-wrap: nowrap. So probably worth keeping consistency with input / button and specifying it.

@josepharhar

Copy link
Copy Markdown
Contributor

The title says "Remove anonymous button content-box" and I'm trying to figure out if that means we would have to change the structure of the shadowroot of the select element or other elements. Otherwise it just sounds like its just replacing style/layout magic with UA stylesheet rules, right?

@emilio

emilio commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

The title says "Remove anonymous button content-box" and I'm trying to figure out if that means we would have to change the structure of the shadowroot of the select element or other elements.

No, there's no change to the shadow root. Blink and Gecko no longer have an anonymous box for performing the centering. This was originally the way we implemented the vertical centering (before align-content: center). See also #12702, which this change fixes.

Otherwise it just sounds like its just replacing style/layout magic with UA stylesheet rules, right?

Yes, that's correct.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants