Closed Bug 1450173 Opened 6 years ago Closed 5 years ago

input with date/time type doesn't center its contents, with "text-align:center"

Categories

(Core :: Layout: Form Controls, defect, P3)

59 Branch
Unspecified
Windows 10
defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: karlcow, Assigned: emilio)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [webcompat] )

Attachments

(2 files)

This is a spin-off of https://webcompat.com/issues/16209

Test case is at 
https://codepen.io/webcompat/pen/MVVeZr?editors=1100


<fieldset>
    <label>
        <input value="2018-03-30"
            type="date">
    </label>
    <label>
        <input value="05:15"
            type="time">
    </label>
</fieldset>

with 
label {display:flex;
       align-items:center;}
input {flex: 1 0 auto;
       text-align:center;}


In Chrome both fields are centered. 
In Firefox they are left aligned.
Flags: webcompat?
I guess the author is expecting "text-align:center" to center the contents of the input?  That's a somewhat reasonable expectation, though I don't know if the precise layout of these controls is specced at all.


(I don't recall the precise setup of the internals of these datetime widgets -- I think there's a flex container and there's a flex item (or maybe several) for the text and a flex item for the "x" clear-icon.  For "text-align" to have an effect, we'd need to be sure that property inherits down to a block around *just* the text, and we'd need that block to be as wide (or nearly as wide) as the input widget itself.)
Reduced testcase jsfiddle: https://jsfiddle.net/aj5drx4t/
Or just as data URI:
  data:text/html,<input type="date" style="width:30em; text-align:center">

The "mm/dd/yyyy" text is centered in Chrome and Edge, but not in Firefox.
Summary: input with date/time type are not centered → input with date/time type doesn't center its contents, with "text-align:center"
No longer depends on: datetime-bugs

Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.

Webcompat Priority: --- → ?

See bug 1547409. Migrating whiteboard priority tags to program flags.

Webcompat Priority: ? → ---
Flags: webcompat?
Assignee: nobody → emilio

Also drive-by remove some useless prefixes since user-select was unprefixed in
bug 1492739.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4172c250e867
Allow the datetime wrapper to grow so that you can e.g. align its contents using text-align. r=dholbert
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
QA Whiteboard: [qa-70b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: