Switch to non-native theming of widgets for content on Windows, disabled by default behind widget.disable-native-theme-for-content pref
Categories
(Core :: Widget: Win32, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox75 | --- | fixed |
People
(Reporter: Alex_Gaynor, Assigned: spohl)
References
Details
Attachments
(1 file, 6 obsolete files)
![]() |
||
Updated•8 years ago
|
![]() |
||
Updated•8 years ago
|
![]() |
||
Updated•7 years ago
|
![]() |
||
Comment 1•7 years ago
|
||
![]() |
||
Comment 2•7 years ago
|
||
![]() |
||
Updated•7 years ago
|
![]() |
||
Updated•7 years ago
|
Updated•7 years ago
|
![]() |
||
Updated•7 years ago
|
![]() |
||
Comment 4•7 years ago
|
||
Updated•7 years ago
|
Comment 5•7 years ago
|
||
Comment 6•7 years ago
|
||
![]() |
||
Comment 7•7 years ago
|
||
Comment 8•7 years ago
|
||
Comment 9•7 years ago
|
||
Comment 10•7 years ago
|
||
Reporter | ||
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Comment 13•7 years ago
|
||
Comment 14•7 years ago
|
||
Comment 15•7 years ago
|
||
Comment 16•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Assignee | ||
Comment 17•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Comment 18•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Updated•7 years ago
|
![]() |
||
Updated•7 years ago
|
![]() |
||
Updated•7 years ago
|
Updated•7 years ago
|
Assignee | ||
Comment 19•7 years ago
|
||
Assignee | ||
Comment 20•7 years ago
|
||
Depends on D24727
Comment 21•6 years ago
|
||
I don't know how you plan to use content-common.css, but if this is going to be used in forms.css, it's going to create web compat issues, since we're changing the default UA styles of HTML elements. Also, using this in the Firefox UI will likely cause regressions to specificity issues (this is fixable, but the first issue isn't).
Can't we use Chrome's approach of defining their own "native" widget appearance on Windows? So instead of making -moz-appearance: button
render the native Windows button appearance, it would paint an image that we would create ourselves as the background. This avoids the need of having to refactor CSS and having to deal with web compat problems.
Comment 22•6 years ago
|
||
I don't know much about this code, but I guess that would mean rewriting widget/windows/nsNativeThemeWin.cpp
to get rid of the native theme calls.
Comment 23•6 years ago
|
||
Or if we still want to keep native theme calls for the parent process, we could have a brand new widget/nsBasicTheme.cpp
and make nsPresContext::GetTheme()
return the theme conditionally from widget/windows/nsNativeThemeWin.cpp
or widget/nsBasicTheme.cpp
.
Assignee | ||
Comment 24•6 years ago
|
||
(In reply to Tim Nguyen :ntim from comment #21)
I don't know how you plan to use content-common.css, but if this is going to be used in forms.css, it's going to create web compat issues, since we're changing the default UA styles of HTML elements. Also, using this in the Firefox UI will likely cause regressions to specificity issues (this is fixable, but the first issue isn't).
The current idea isn't so much to use content-common.css in forms.css, but rather in addition to forms.css, with the rules in content-common.css taking precedence over forms.css.
In terms of web compat, can you give specific examples?
content-common.css uses a lot of the same CSS that is used by the Firefox UI, but is not itself expected to be used by the Firefox UI. This may get refactored at some point and consolidated, but we are not trying to do this here.
![]() |
||
Updated•6 years ago
|
Comment 25•6 years ago
|
||
In terms of web compat, can you give specific examples?
Mats mentioned the concerns in comment 8, it doesn't sound like the scope of the current patch will let us avoid those.
If I understand correctly the current patches, basically every property that is set by content-common.css but not set by forms.css will basically cause compat issues: one example is the box-shadow/outline on focused inputs, buttons, which is something websites will now have to override with box-shadow: none if they define their own input border/background styles.
That's just one of many issues that could arise from changing the web content default UA CSS.
Since content-common.css would not be able to set more properties than forms.css, then it sort of makes content-common.css useless, since forms.css styles would take precedence over content-common.css all the time, meaning that just changing the different -moz-appearance values to none in forms.css would have the same effect as this patch.
I think a more safe approach here is to implement a new fake "native" theme for -moz-appearance: button, textfield, etc. that doesn't involve any platform API calls using C++, so the default UA styles don't need to change at all. That's basically what Blink is doing at the moment on Windows.
It would also give you more flexibility in regards of what default appearance you can apply, which is beneficial if you need to implement extra default styling for accessibility.
Comment 26•6 years ago
|
||
(In reply to Tim Nguyen :ntim from comment #25)
I think a more safe approach here is to implement a new fake "native" theme for -moz-appearance: button, textfield, etc. that doesn't involve any platform API calls using C++, so the default UA styles don't need to change at all.
I agree, Tim's suggestion is the better approach.
Comment 27•6 years ago
|
||
The corresponding Android bug for using C++ theming instead of CSS overrides is bug 958999.
Assignee | ||
Comment 28•6 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #26)
(In reply to Tim Nguyen :ntim from comment #25)
I think a more safe approach here is to implement a new fake "native" theme for -moz-appearance: button, textfield, etc. that doesn't involve any platform API calls using C++, so the default UA styles don't need to change at all.
I agree, Tim's suggestion is the better approach.
To confirm my understanding: You both prefer an approach along the lines of what was mentioned in comment 13 and comment 14 due to the nature of the API as explained in comment 12, correct? The difficulty here has always been that the Windows API isn't just returning a set of values.
What if we only changed the properties that are currently set by forms.css? This would restyle the "Moz Unstyled Inputs" on the left side of http://stephenhorlander.com/form-controls.html. This wouldn't allow us to mirror the existing UX on our about: pages as we intended, but it may be an acceptable compromise. This would require some exploration to see how far we can take our styling and whether or not the result is acceptable.
Comment 29•6 years ago
|
||
(In reply to Stephen A Pohl [:spohl] from comment #28)
(In reply to Markus Stange [:mstange] from comment #26)
(In reply to Tim Nguyen :ntim from comment #25)
I think a more safe approach here is to implement a new fake "native" theme for -moz-appearance: button, textfield, etc. that doesn't involve any platform API calls using C++, so the default UA styles don't need to change at all.
I agree, Tim's suggestion is the better approach.
To confirm my understanding: You both prefer an approach along the lines of what was mentioned in comment 13 and comment 14 due to the nature of the API as explained in comment 12, correct? The difficulty here has always been that the Windows API isn't just returning a set of values.
No, I was suggesting more simple than comment 13 and comment 14, we could create a basic C++ stub theme that doesn't look native at all. This is what Google Chrome is doing.
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 30•6 years ago
|
||
Assignee | ||
Comment 31•6 years ago
|
||
Changing bug title to more accurately reflect the current approach.
![]() |
||
Updated•6 years ago
|
Comment 32•6 years ago
|
||
News on Microsoft's changes around this: https://blogs.windows.com/msedgedev/2019/10/15/form-controls-microsoft-edge-chromium/
Assignee | ||
Comment 33•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 34•6 years ago
|
||
(In reply to Asif Youssuff from comment #32)
News on Microsoft's changes around this: https://blogs.windows.com/msedgedev/2019/10/15/form-controls-microsoft-edge-chromium/
Eg. https://chromium.googlesource.com/chromium/src/+/adc4f610d1e80b46f55e4a1ddabf06be1ace394c
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
FYI, This probably blocks "Bug 1534333 - radio and checkbox need vector graphics" as well...which is likely a dup of 649948.
Assignee | ||
Comment 37•6 years ago
|
||
This is currently disabled by default behind the widget.disable-native-theme-for-content
pref. I will be filing several followup bugs in the coming days, including a bug to turn this on by default.
Comment 38•6 years ago
|
||
FWIW, if you're in the mood to innovate a bit, a unique appearance for indeterminate radios (disabled and not) would be a nice addition.
Currently, they can't be visually distinguished from unchecked radios...in Chromium, Edgium, current FF implementations, or with aforementioned pref set.
Comment 39•6 years ago
|
||
bugherder |
![]() |
||
Comment 40•6 years ago
|
||
Comment 41•6 years ago
|
||
Some feedback on the designs (not knowing a better place to put this at present), beyond things covered by bugs newly created:
-
The increase from 13px to 17px for checkboxes and radio buttons while sticking with
vertical-align: baseline
harms the layout of the vast majority of uses of checkboxes. I’m immediately seeing all kinds of ugliness all over the place, in addon preference pages, in websites, everywhere that doesn’t basically replace checkboxes. -
That you can’t reduce the width of checkboxes and radio buttons below 17px can prevent sites from fixing that, too, and I suspect it may also harm some (though not most) “replace the checkbox widget” styles due to the control-made-invisible being larger than desired and unshrinkable.
-
Making buttons largely indistinguishable from text boxes is extremely bad. (At a casual glance, until hover or focus, the difference is only the side padding of buttons.) They need to be styled visibly differently.
- The buttons don’t look like buttons in any way. They should.
-
<select>
now lacks any visible focus indicator. -
In its hover behaviour,
<select>
is now styled more like a button than a textbox, which is contrary to how Windows has always (literally always; I can think of no counterexamples ever) treated them (though in line with most of macOS, where the distinction is fairly subtle, and in line with GTK, where the difference is huge and quite obnoxious). -
I believe the filled blue colouring for radio buttons and checkboxes is a mistake—it’s too opinionated, and clashes with existing site designs in a way that the old non-filled black style seldom did. (Related, blue border around a white centre feels not right for Windows, which has always had a border, then a white ring, then a filled centre; though it doesn’t feel as not-right as I thought it would.)
-
Parts of the borders seem to be drawn outside the bounding box, which causes trouble with overflow, as seen at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input.
<input type=file>
is a particularly severe example, being visually broken always unless you addpadding: 1px
or similar. -
Borders are also drawn on subpixels, which is undesirable.
-
Unchecked checkbox and radio having a much thicker border than other controls feels weird, though I can understand why you’d do it. But for reference, Windows’ now-recommended styles use that sort of thicker border on all controls. But doing it everywhere would probably harm layout and appearance much more.
-
I’m not sold on the border radius for checkboxes. It’s definitely not Windows’ way, and subjectively feels a tad more opinionated than not. I could say similar about text inputs (with which the checkbox radius is broadly consistent), but it doesn’t feel so significant for them, despite definitely not being the Windows way.
-
The default invalid form field box-shadow clashes with the checkbox and radio button appearance.
-
On
<input type=range>
, the hit boxes for the up/down arrows don’t extend to the right edge of the control, and they should.
For checkbox and radio button styles, I feel their appearance in about:preferences is closer to Windows’ conventions and a bit more neutral, though I’d still consider its blue a tad dubious for general use.
Assignee | ||
Comment 42•6 years ago
|
||
I'm going to n-i :shorlander for the feedback in comment 41. Note that there are some things (such as the lack of focus rings/indicators, bug 1615095) that are filed as follow up bugs that need to be addressed before we can turn this on by default.
Comment 43•6 years ago
|
||
A few more notes from a solid day of using it now:
-
The indeterminate checkbox style is wonky—looks like it’s trying to draw a white dash, but didn’t replace the grey outline with the blue fill.
-
I’ve encountered genuine layout and clipping problems in a few more places from the drastic increase in the size (particularly height, from padding) of buttons and text boxes. Things like a textbox now overflowing its containers vertically.
-
The thicker borders on checkboxes and radio buttons are clashing visually all over the place—it’s normal for sites to style text boxes but not checkboxes and radio buttons, probably mostly because doing them is much more fiddly; so this matters. The more I use the web at large, the more I become convinced that 2px rather than 1px borders is a bad idea.
-
Most web designs have more or less depended on the idea that checkboxes and radio buttons are 13px×13px. Increasing it to 17px×17px is regularly breaking layouts by a few pixels and leaving things surprisingly ugly, occasionally causing content clipping (e.g. the “enable flair on this subreddit” checkbox and label on https://old.reddit.com/r/rust if you’re logged in) and regularly leaving controls badly misaligned with text, especially in apps that have gone for smaller font-sizes (remember that 16px is the default for web content, but desktop apps have historically used decidedly smaller font sizes for their chrome, and mostly still do), which are also the things more likely to have lots of form controls.
-
As an example of these last two points, the overly large checkboxes with their thick borders and rounded corners are comically out of place in Fastmail’s webmail in the list of emails, especially in the dark theme. (If it goes ahead as it is, it might be just enough for me to decide we should implement our own checkbox and radio button style on desktop. I don’t consider this a good thing.)
-
Within the current macOS-like style, if the radio button is made huge, I expect the thickness of the blue border to scale with the radio button. Currently it stays the same thickness while the middle white grows, which makes it less obviously an oversized radio button.
-
On the colour thing, I wonder whether there’s a way of letting the site specify colours to use, particularly for the primary blue. Simplest thing I can think of is defaulting to
color: blue;
(rather thancolor: inherit
or similar), but that would be rather problematic. Not sure whether there’s active work in any standard that could sort this out. A custom property that the browser uses, a::part()
, I dunno.
Comment 44•6 years ago
|
||
I'd like to add to the feedback: When hovering a checkbox or radio button, the color appears to darken. Darker colors usually are used to show a pressed state, not a hover state, so this is a bit misleading to me. Generally, hover is indicated by a lighter color.
Assignee | ||
Comment 45•6 years ago
|
||
Filed several bugs to capture the feedback received so far (see individual bugs below). I've need-info'd :shorlander in the respective bugs, so removing it from this bug here:
(In reply to Chris Morgan from comment #41 and comment #43)
Some feedback on the designs (not knowing a better place to put this at present), beyond things covered by bugs newly created:
The increase from 13px to 17px for checkboxes and radio buttons while sticking with
vertical-align: baseline
harms the layout of the vast majority of uses of checkboxes. I’m immediately seeing all kinds of ugliness all over the place, in addon preference pages, in websites, everywhere that doesn’t basically replace checkboxes.That you can’t reduce the width of checkboxes and radio buttons below 17px can prevent sites from fixing that, too, and I suspect it may also harm some (though not most) “replace the checkbox widget” styles due to the control-made-invisible being larger than desired and unshrinkable.
I believe the filled blue colouring for radio buttons and checkboxes is a mistake—it’s too opinionated, and clashes with existing site designs in a way that the old non-filled black style seldom did. (Related, blue border around a white centre feels not right for Windows, which has always had a border, then a white ring, then a filled centre; though it doesn’t feel as not-right as I thought it would.)
Unchecked checkbox and radio having a much thicker border than other controls feels weird, though I can understand why you’d do it. But for reference, Windows’ now-recommended styles use that sort of thicker border on all controls. But doing it everywhere would probably harm layout and appearance much more.
I’m not sold on the border radius for checkboxes. It’s definitely not Windows’ way, and subjectively feels a tad more opinionated than not. I could say similar about text inputs (with which the checkbox radius is broadly consistent), but it doesn’t feel so significant for them, despite definitely not being the Windows way.
The default invalid form field box-shadow clashes with the checkbox and radio button appearance.
For checkbox and radio button styles, I feel their appearance in about:preferences is closer to Windows’ conventions and a bit more neutral, though I’d still consider its blue a tad dubious for general use.
The indeterminate checkbox style is wonky—looks like it’s trying to draw a white dash, but didn’t replace the grey outline with the blue fill.
The thicker borders on checkboxes and radio buttons are clashing visually all over the place—it’s normal for sites to style text boxes but not checkboxes and radio buttons, probably mostly because doing them is much more fiddly; so this matters. The more I use the web at large, the more I become convinced that 2px rather than 1px borders is a bad idea.
Most web designs have more or less depended on the idea that checkboxes and radio buttons are 13px×13px. Increasing it to 17px×17px is regularly breaking layouts by a few pixels and leaving things surprisingly ugly, occasionally causing content clipping (e.g. the “enable flair on this subreddit” checkbox and label on https://old.reddit.com/r/rust if you’re logged in) and regularly leaving controls badly misaligned with text, especially in apps that have gone for smaller font-sizes (remember that 16px is the default for web content, but desktop apps have historically used decidedly smaller font sizes for their chrome, and mostly still do), which are also the things more likely to have lots of form controls.
As an example of these last two points, the overly large checkboxes with their thick borders and rounded corners are comically out of place in Fastmail’s webmail in the list of emails, especially in the dark theme. (If it goes ahead as it is, it might be just enough for me to decide we should implement our own checkbox and radio button style on desktop. I don’t consider this a good thing.)
Within the current macOS-like style, if the radio button is made huge, I expect the thickness of the blue border to scale with the radio button. Currently it stays the same thickness while the middle white grows, which makes it less obviously an oversized radio button.
On the colour thing, I wonder whether there’s a way of letting the site specify colours to use, particularly for the primary blue. Simplest thing I can think of is defaulting to
color: blue;
(rather thancolor: inherit
or similar), but that would be rather problematic. Not sure whether there’s active work in any standard that could sort this out. A custom property that the browser uses, a::part()
, I dunno.
Making buttons largely indistinguishable from text boxes is extremely bad. (At a casual glance, until hover or focus, the difference is only the side padding of buttons.) They need to be styled visibly differently.
The buttons don’t look like buttons in any way. They should.
I’ve encountered genuine layout and clipping problems in a few more places from the drastic increase in the size (particularly height, from padding) of buttons and text boxes. Things like a textbox now overflowing its containers vertically.
<select>
now lacks any visible focus indicator.In its hover behaviour,
<select>
is now styled more like a button than a textbox, which is contrary to how Windows has always (literally always; I can think of no counterexamples ever) treated them (though in line with most of macOS, where the distinction is fairly subtle, and in line with GTK, where the difference is huge and quite obnoxious).
Parts of the borders seem to be drawn outside the bounding box, which causes trouble with overflow, as seen at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input.
<input type=file>
is a particularly severe example, being visually broken always unless you addpadding: 1px
or similar.Borders are also drawn on subpixels, which is undesirable.
- On
<input type=range>
, the hit boxes for the up/down arrows don’t extend to the right edge of the control, and they should.
(In reply to Sam Johnson from comment #44)
I'd like to add to the feedback: When hovering a checkbox or radio button, the color appears to darken. Darker colors usually are used to show a pressed state, not a hover state, so this is a bit misleading to me. Generally, hover is indicated by a lighter color.
Comment 46•6 years ago
|
||
Should we maybe reshuffle some of these dependencies? Using a closed bug for tracking is a bit annoying.
Assignee | ||
Comment 47•6 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #46)
Should we maybe reshuffle some of these dependencies? Using a closed bug for tracking is a bit annoying.
I agree.
Description
•