Closed Bug 1491811 Opened 6 years ago Closed 5 years ago

Rules: replace custom checkbox with -moz-appearance:checkbox

Categories

(DevTools :: Inspector: Rules, enhancement, P2)

enhancement

Tracking

(firefox72 fixed)

RESOLVED FIXED
Firefox 72
Tracking Status
firefox72 --- fixed

People

(Reporter: fvsch, Assigned: miker)

References

(Regressed 1 open bug)

Details

(Whiteboard: [dt-q])

Attachments

(8 files, 6 obsolete files)

112.00 KB, image/png
Details
47 bytes, text/x-phabricator-request
Details | Review
47.99 KB, image/png
Details
53.06 KB, image/png
Details
53.53 KB, image/png
Details
30.30 KB, image/png
Details
3.81 KB, image/png
Details
5.96 KB, image/png
Details
In a code review for bug 1490491, :pbro suggested removing the custom checkbox image used in Rules (for disabling declarations) and using the same design as in other tools (e.g. the Console or Network toolbars).

Trying it quickly on macOS, it seems to be working well. I’m not sure which size would be best:

- keeping the current 14x14 size, we get a 12x12 image
- with a 12x12 element, we get a 10x10 image

The smaller checkbox looks a bit better to me, but I’m not sure that the checkbox design for other OSes will work well at small sizes too.
If needed, we could use the standard-looking checkbox on some platforms, and fall back to the new SVG checkbox for others.

Victoria, do you have an opinion on this checkbox design, if we should try to use a more standard one and which size might work well?
Flags: needinfo?(victoria)
Whiteboard: [dt-q]
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Component: Inspector → CSS Rules Inspector
Ever confirmed: true
Priority: -- → P2
This might look out of place with the devtools dark theme, as it will be the only white element.
(In reply to Tim Nguyen :ntim from comment #2)
> This might look out of place with the devtools dark theme, as it will be the
> only white element.

(I'm talking about -moz-appearance: checkbox, not using the SVG)
Tried `-moz-appearance: checkbox` quickly on Ubuntu, and unlike on macOS it doesn't pick up the `checked` attribute value, so the checkbox looks empty whatever its state. We probably need a real <input type=checkbox> for a good result.

> This might look out of place with the devtools dark theme, as it will be the
> only white element.

It does look a bit out of place, but we're already doing it for the Grid selector (Inspector > Layout), the class toggler (in Inspector > Rules), the Settings page, the Console and Network toolbars, etc.
So we may as well be consistent.

Apparently, macOS Mojave (10.14) dark mode comes with checkboxes and radio buttons which have a dark background. I wonder if there is something planned for that in Firefox.
(In reply to Florens Verschelde from comment #4)
> Apparently, macOS Mojave (10.14) dark mode comes with checkboxes and radio
> buttons which have a dark background. I wonder if there is something planned
> for that in Firefox.

The macOS dark mode is not always in sync with the devtools dark mode.
I was just wondering if at some time Firefox would be able to paint native-looking checkboxes in their “dark” variant, and if we could use that.
I love the look of the 12px! Especially if we even make the click target a bit larger ;D. Not worried about doing native checkboxes in Ubuntu if it's a better experience.

Filed a dark mode empty checkbox issue for later: https://github.com/devtools-html/ux/issues/32
Flags: needinfo?(victoria)
Related:

- The new checkbox image from bug 1490491 landed
- In bug 1190113 we added a left border to the clickable area, so that clicks on the left side of the checkbox activates it

If we end up using a native checkbox, and perhaps make it small (e.g. 12px), we should consider having a larger element around it (to the left, but also a few pixels to the top/bottom and right) that catches clicks.

We can use real <input type="checkbox"> elements, keep the native style if it looks alright, and give it a custom style with -moz-appearance: none if it doesn't.

Assignee: nobody → mratcliffe
Status: NEW → ASSIGNED
Attached image Screenshot 2019-10-15 at 16.40.41.png (obsolete) —

I decided to go with the 12px version because Victoria likes it.

@victoria does this work for you?

Flags: needinfo?(victoria)

Nice, thanks for working on this Mike! Couple tweaks:

  • Needs more spacing between the checkbox and the text (match fvsch's mockup above)
  • Labels should be 1px lower in relation to the checkbox
Flags: needinfo?(victoria)

@victoria I have overlayed this new version in photoshop. The checkbox and text positions match perfectly.

The line height in the mockup is much smaller in our tools but I decided to ignore that as I think our line heights are good.

Is this okay?

Attachment #9101303 - Attachment is obsolete: true
Flags: needinfo?(victoria)

On Linux with Gnome, at least with Fedora's default theme (might be different on Ubuntu, for instance), it looks like native checkboxes can be scaled up but now down.

Their minimum size seems to be 16px.
Our line height in Rules is not always fixed, but it's often 15px or 16px.

It may just be that you need to go down to 8px for the checkbox to resize.

Either way we just need to look at it and see if we need to tweak anything.

The try push should [hopefully] give us a screenshot on each of our target OSs.

Attached image Ubuntu.png (obsolete) —

Ubuntu

Attached image windows.png (obsolete) —
Attached image OSX.png (obsolete) —

The line-height looks tall on Ubuntu. I'm not sure what the DPR was, but with a few guesses and calculations it kinda looks like 17px or maybe 18px? I wonder if that might come from the default margins for input[type="checkbox"] (if they're not reset here and we're not using absolute positioning).

The macOS checkboxes look smaller overall. It looks like they render with 1px of blank space around the graphic, so a width: 12px; height: 12px; checkbox is 10x10 visually. We can fix it using different styles (10px for everyone, 12px for macOS), or keep it like that if we don't mind the difference.

(In reply to Florens Verschelde :fvsch from comment #21)

The line-height looks tall on Ubuntu. I'm not sure what the DPR was, but with a few guesses and calculations it kinda looks like 17px or maybe 18px? I wonder if that might come from the default margins for input[type="checkbox"] (if they're not reset here and we're not using absolute positioning).

I can try resetting the top and bottom margins etc.

The macOS checkboxes look smaller overall. It looks like they render with 1px of blank space around the graphic, so a width: 12px; height: 12px; checkbox is 10x10 visually. We can fix it using different styles (10px for everyone, 12px for macOS), or keep it like that if we don't mind the difference.

Victoria likes that size and it is her call. I have to admit that I think they match the default text size perfectly on OSX.

Attached image image.png

I might be confused about something, but looks like the line height is taller in all the screenshots? (Like 4px taller than the current style?) It would be helpful to see a bigger screenshot that shows several rules.

Victoria likes that size and it is her call.

Thanks, but to clarify, I do often defer this kind of thing to Florens because they are really good at the details 🙂

Flags: needinfo?(victoria)
Attached image OSX.png
Attachment #9101553 - Attachment is obsolete: true
Attached image Linux.png (obsolete) —
Attachment #9101551 - Attachment is obsolete: true
Attached image Win.png (obsolete) —
Attachment #9101552 - Attachment is obsolete: true
Attached image Linux.png
Attachment #9102594 - Attachment is obsolete: true
Attached image Win.png
Attachment #9102598 - Attachment is obsolete: true

To sum up discussions on Slack:

  • not 100% sure a HTML checkbox will render well at small sizes on Windows and Linux (especially Linux)
  • we want to try to roll out the native checkboxes on macOS first, and see if we can enable Windows and Linux later after more testing
Attachment #9101305 - Attachment description: Bug 1491811 - Rules: replace custom checkbox with -moz-appearance:checkbox r?gl! → Bug 1491811 - Rules: replace custom checkbox with -moz-appearance:checkbox r?fvsch!

@fvsch So now we have the resized native checkboxes on OSX and the SVG checkboxes on Windows and Linux... I am happy with this, especially as we have improved accessibility at the same time.

I hope you are happy to review this... otherwise please ping me and let me know.

fvsch wants me to try this again but using -moz-appearance:none on the checkboxes to allow resizing outside of OSX.

Lets give it a try.

We are now using -moz-appearance:none to apply the SVG checkboxes under Windows and Linux and using the native checkboxes on OSX.

Flags: needinfo?(florens)
Attachment #9101305 - Attachment is obsolete: true
Attachment #9101305 - Attachment is obsolete: false

Super happy to see this shaping up. Re. questions you had about -moz-appearance: none making the checkbox invisible: this is probably because of the deleted line in devtools/client/jar.mn: if we don't restore it, Firefox doesn't find the checkbox image.

Flags: needinfo?(florens)
Pushed by mratcliffe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e69e9a6aa261
Rules: replace custom checkbox with -moz-appearance:checkbox r=fvsch
Pushed by mratcliffe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5b0caada1999
Rules: replace custom checkbox with -moz-appearance:checkbox r=fvsch
Flags: needinfo?(mratcliffe)
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72

There seems to be a small performance regression on some inspector tests, and it might be linked to this bug:

regression: 2-4 % on select/deselector and improvement on expandall manychildren.

The regression is small and there is also an improvement. Not necessarily worth a follow up, but maybe you have an idea about what might have caused this and want to look into it.

(see comment above)

Flags: needinfo?(mratcliffe)

We also observed this.

On OSX we are now using native checkboxes but there is less of a regression there.

In the CSS we use e.g. :root[platform="linux"] to identify the different OSes. We need to do this because Linux & Windows don't reliably resize checkboxes.

I guess :root[platform="mac"] etc. are slow selectors so I suppose that this is what is causing the regression.

Flags: needinfo?(mratcliffe)
Regressions: 1600365
Regressions: 1618243
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: