Closed Bug 1000077 Opened 10 years ago Closed 10 years ago

Padding on <input type=number> affects spinner button pseudo elements

Categories

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

29 Branch
x86_64
Windows 7
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: ian+bugzilla, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: testcase)

Attachments

(4 files)

Padding on <input type=number> applies to spinner button pseudo elements

This behaviour on inputs is different to Chrome/Blink, where padding (padding-right, for instance) is only applied to the left of the spinners, not to the right of them.

I'm not sure which behaviour is correct, but the inconsistency makes it difficult to accurately position things 'over' the input without overlapping the pseudo elements (see example URL). I'm assuming this could also mean inconsistencies when it comes to styling the pseudo element spinners themselves (if this becomes available).
Blocks: number-input
Severity: normal → minor
Status: UNCONFIRMED → NEW
Component: DOM: Core & HTML → Layout: Form Controls
Ever confirmed: true
Keywords: testcase
Priority: -- → P4
> I'm not sure which behaviour is correct

There is no spec for how number inputs should render, so both are correct.  So would be not showing a spinner at all, not showing a textbox at all and providing some other sort of number-selection UI, etc.
(In reply to Ian Oliver from comment #0)
> This behaviour on inputs is different to Chrome/Blink, where padding
> (padding-right, for instance) is only applied to the left of the spinners,
> not to the right of them.

Are you sure?

Chrome and Firefox render your URL approximately the same, for me. (The main noticable difference is that the input is slightly taller in Firefox). I'll attach screenshots. Maybe Chrome has changed their behavior [or it varies cross-platform]? Or maybe I'm misunderstanding you.
Here's a screenshot on Firefox Nightly (31.0a1 (2014-04-22)) on 64-bit Linux.
...and here's a screenshot in Chrome on the same machine (Version 36.0.1941.0 dev aura) (installed using a "google-chrome-unstable" .deb file from Google)
Yep, I've checked and they render differently. This is Chrome 35.0.1916.47 beta-m, Win 7, 64-Bit. Sorry, I should have said that checking the radios applies different padding-right values to the input. The units (cm, mm etc.) are absolutely positioned over the top of the input.
This is the latest Aurora (as of yesterday).
Ah, sorry - I hadn't tried clicking the radio buttons.

I can reproduce your results with Chrome 34 -- they keep the spinner buttons right-aligned. But Chrome 36 matches Firefox; so it appears that they decided to change this behavior.

Per comment 1, this isn't defined in any spec, so there's no one "right answer"; however, given that Chrome dev version has switched to match Firefox on this, we probably shouldn't switch away to match their old version. :)

So this is probably INVALID (in the sense that there's no clear bug here, and no clear reason to change our behavior).
(And more importantly from your content's perspective: you probably don't want to build a layout that depends on the current Chrome version's behavior, if upcoming versions of Chrome are changing to break your assumptions.)
(In reply to Daniel Holbert [:dholbert] from comment #7)
> I can reproduce your results with Chrome 34 -- they keep the spinner buttons
> right-aligned. But Chrome 36 matches Firefox; so it appears that they
> decided to change this behavior.
> 
> Per comment 1, this isn't defined in any spec, so there's no one "right
> answer"; however, given that Chrome dev version has switched to match
> Firefox on this, we probably shouldn't switch away to match their old
> version. :)
> 
> So this is probably INVALID (in the sense that there's no clear bug here,
> and no clear reason to change our behavior).

Right you are - I just looked in Chrome Canary 36 (should have done that before, *facepalm*) and it's the same behaviour as Firefox. They must've changed for Chrome 36, matching Firefox's behaviour.

As said, even though there is technically no right or wrong, I'm glad there's convention in the presentation, and now seemingly in the details.

Regarding the content, yeah, it's a pretty janky method, but the variables/magic numbers were pretty safe (at the time). Will definitely need some re-thinking now though!
Thanks, and good luck!

[Resolving INVALID per comment 7 through comment 9.]
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: