You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should padding be respected on "natively styled" form controls? #8560
topic: formsForms and form controls: input types, submission, constraint validation and autofilltopic: renderingHow elements are expected to render: the user agent style sheet
Chrome respects the author padding, but adds some magical extra padding, only to <select>.
Firefox respects the author padding.
With appearance: none, all browsers respect the author padding.
My intuition is that given padding is not one of the properties that disable native appearance, it should be respected as is (that is, that the Firefox behavior is preferable).
Firefox used to have magical "extra" padding on <select>regardless of native appearance which was removed in bug 1560824 and bug 1582545 for the block and inline directions respectively.
The Chrome code claims to match (old) Firefox behavior, but it never did (because Firefox did this regardless of appearance).
My preference is to match current Firefox behavior, though ignoring padding could also be an option (rather unfotunate IMO, tho). What Chrome is doing for <select> seems rather bespoke. However, I'm curious about thoughts from others and whether we could reach interop here.
The reason Safari doesn't match author padding here is because the native appearance can't be painted at certain sizes. One exception is <button> where we paint a custom "native" style at larger sizes in order to support multi-line/custom content that can be inside buttons, see data:text/html,<button style="padding: 20px">hello</button><button>world</button>.
Given the Safari wants to render native controls, honoring padding would mean having to support 2 types of "native" styling, the styling that's actually native, and one that supports arbitrary sizes.
Sorry, in the meeting just now, I misunderstood due to a quick scan of the issue. This issue is just about the <select> control, right? The <button> element seems to respect padding regardless of appearance on Chromium, Gecko, WebKit, at least for me on a Mac.
Yeah, exactly. This is interopearable in the <button> case and not in the <select> case (not sure if there are others). I think we should make <select> just like <button>.
Yeah, exactly. This is interopearable in the <button> case and not in the <select> case (not sure if there are others). I think we should make <select> just like <button>.
Ok, thanks. Then I agree we should try to make this interoperable. The best option from a developer point of view would seem to be to respect the padding even when appearance:auto. Chromium-wise, I think that just requires returning zero here and something smaller here. If we can spec this and get a test, I'm happy to make the Chromium change. This seems hard to write a WPT for, right? I suppose just a <link rel="mismatch" type test that makes sure padding has an effect?
I would like to note that WebKit cannot truly support padding on "natively styled" <select>. Our control is painted using AppKit's NSPopupButtonCell – which draws at 4 fixed sizes, and does not allow us to customize padding. For the same reason, WebKit does not support arbitrary font sizes on "natively styled" <select>.
If WebKit were to "respect" padding for this form of <select>, the rendered appearance would essentially be as if the <select> were wrapped in a <span> with the specified padding.
In WebKit <input type=button value=Foo> also doesn't respect padding. I think the difference is the internal appearance is push-button vs for <button> it is square-button. (The appearance values aren't controllable from author CSS since the keywords map to auto.)
In WebKit <input type=button value=Foo> also doesn't respect padding. I think the difference is the internal appearance is push-button vs for <button> it is square-button. (The appearance values aren't controllable from author CSS since the keywords map to auto.)
topic: formsForms and form controls: input types, submission, constraint validation and autofilltopic: renderingHow elements are expected to render: the user agent style sheet
Activity
nt1m commentedon Nov 29, 2022
The reason Safari doesn't match author padding here is because the native appearance can't be painted at certain sizes. One exception is
<button>where we paint a custom "native" style at larger sizes in order to support multi-line/custom content that can be inside buttons, seedata:text/html,<button style="padding: 20px">hello</button><button>world</button>.Given the Safari wants to render native controls, honoring padding would mean having to support 2 types of "native" styling, the styling that's actually native, and one that supports arbitrary sizes.
@pxlcoder Do you have an opinion regarding this?
emilio commentedon Nov 29, 2022
@nt1m you support arbitrary font sizes and so, right? How is this not similar?
zcorpan commentedon Dec 8, 2022
selectin this issue is only drop-down select. Related issue for listbox select: #8270mfreed7 commentedon Dec 8, 2022
Sorry, in the meeting just now, I misunderstood due to a quick scan of the issue. This issue is just about the
<select>control, right? The<button>element seems to respectpaddingregardless ofappearanceon Chromium, Gecko, WebKit, at least for me on a Mac.Is that right?
Chrome:

Safari:

Firefox:

emilio commentedon Dec 8, 2022
Yeah, exactly. This is interopearable in the
<button>case and not in the<select>case (not sure if there are others). I think we should make<select>just like<button>.mfreed7 commentedon Dec 16, 2022
Ok, thanks. Then I agree we should try to make this interoperable. The best option from a developer point of view would seem to be to respect the
paddingeven whenappearance:auto. Chromium-wise, I think that just requires returning zero here and something smaller here. If we can spec this and get a test, I'm happy to make the Chromium change. This seems hard to write a WPT for, right? I suppose just a<link rel="mismatch"type test that makes sure padding has an effect?pxlcoder commentedon Dec 16, 2022
I would like to note that WebKit cannot truly support padding on "natively styled"
<select>. Our control is painted using AppKit'sNSPopupButtonCell– which draws at 4 fixed sizes, and does not allow us to customize padding. For the same reason, WebKit does not support arbitrary font sizes on "natively styled"<select>.If WebKit were to "respect" padding for this form of
<select>, the rendered appearance would essentially be as if the<select>were wrapped in a<span>with the specified padding.zcorpan commentedon Dec 16, 2022
In WebKit
<input type=button value=Foo>also doesn't respectpadding. I think the difference is the internalappearanceispush-buttonvs for<button>it issquare-button. (The appearance values aren't controllable from author CSS since the keywords map toauto.)http://software.hixie.ch/utilities/js/live-dom-viewer/saved/11113
nt1m commentedon Dec 16, 2022
We do want to fix that: https://bugs.webkit.org/show_bug.cgi?id=238803 since it affects our ability to render multi-line
<input type=button>(push-buttoncannot be rendered with multiple lines, platform limitation).