Closed Bug 1501483 Opened 2 years ago Closed 2 years ago

Add -webkit-appearance:meter and make that the default for <meter> for compatibility with other UAs

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: mats, Assigned: mats)

References

Details

(Keywords: dev-doc-complete, testcase)

Attachments

(2 files)

Attached file Testcase
We should add a new 'meter' value to '-webkit-appearance' in
the style system, and make the existing 'meterbar' value an
alias for 'meter'.

We should also replace any existing 'meterbar' values in our
UA sheets with 'meter'.  In particular, the default value
for <meter>.

Chrome uses '-webkit-appearance:meter' on the <meter> element.
Setting '-webkit-appearance:none' removes the theme and it
renders its contents instead.  Setting display:inline appears
to work but it appears they use an inner anonymous block
to render the contents, so it ends up as a block-in-inline.
display:contents works as display:none.

Edge, on the other hand, uses '-webkit-appearance:none'
by default on <meter> and it never renders its contents.
display:contents appears to have no effect.
Setting the 'background' doesn't seem to work at all.

https://html.spec.whatwg.org/multipage/form-elements.html#the-meter-element
says:
"Content model:
    Phrasing content, but there must be no meter element descendants."
...
"Authors are encouraged to include a textual representation of the gauge's state in the element's contents, for users of user agents that do not support the meter element."
> Edge, ... display:contents appears to have no effect.

Oh right, I forgot - they don't support it, LOL.
Safari also has '-webkit-appearance:meter' on <meter>.
It renders the test somewhat like Firefox - not rendering
its contents in particular.  We should probably try to
avoid emulating that part Chrome's behavior if we can
(and file a bug on Chrome instead).
Note that chrome has something similar for <progress> and it's not fun:

  https://bugs.chromium.org/p/chromium/issues/detail?id=853558

I don't know if they have the same bug with <meter>, but it wouldn't surprise me.
Yeah, technically it's a violation of the HTML spec since they do
support <meter>.   I read the spec text as only applying to UAs
that don't support the <meter> element at all, in which case
the contents will render naturally.
Keep our old value 'meterbar' as an alias for now, but unship 'meterchunk'
by restricting it to UA/chrome sheets only.
Attachment #9023257 - Flags: review?(jwatt)
Attachment #9023257 - Flags: review?(jwatt) → review+
Pushed by mpalmgren@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/06421db62f78
Add -webkit-appearance:meter and make that the default for <meter> for compatibility with other UAs.  r=jwatt
https://hg.mozilla.org/mozilla-central/rev/06421db62f78
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Keywords: dev-doc-needed
Duplicate of this bug: 1481649
Note to MDN writers:

I've added a note to the Fx65 rel notes to cover this:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/65#CSS

As for the docs, this should be a simple matter of adding the value to the appearance reference page and the compat data.

Updated the table to add meter support for FF, made it standard, and added comment on meterbar to use meter instead. https://developer.mozilla.org/en-US/docs/Web/CSS/appearance

You need to log in before you can comment on or make changes to this bug.