Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date input text not vertically aligned in IE 11 #14234

Closed
carbonrobot opened this issue Jul 24, 2014 · 20 comments
Closed

Date input text not vertically aligned in IE 11 #14234

carbonrobot opened this issue Jul 24, 2014 · 20 comments

Comments

@carbonrobot
Copy link

The "Special styles for iOS temporal inputs" in forms.less creates an issue with IE11 where date inputs misalign the text vertically until the user places the cursor inside the input. See http://jsbin.com/foqex/2 for reference. IE8+ was corrected in #12669

@cvrebert
Copy link
Collaborator

Was presumably fixed by 5713bd7.

@carbonrobot
Copy link
Author

IE11 is ignoring the ~"/0" and using the line height of the control. IE8-10 fixed by 5713bd7

@cvrebert
Copy link
Collaborator

Confirmed that input[type="date"].form-control is broken in IE11 (tested w/ http://jsfiddle.net/cvrhulu/VeLQn/ ).
CC: @mdo

Does this qualify as a browser bug in IE11?

@cvrebert cvrebert added this to the v3.2.1 milestone Jul 24, 2014
@cvrebert cvrebert added the css label Jul 24, 2014
@carbonrobot
Copy link
Author

Possible solution, but very ugly

// forms.less
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {  
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="month"] {
     line-height: @line-height-base;
   }
}

@cvrebert
Copy link
Collaborator

There's also this IE11+ CSS hack: http://browserhacks.com/#hack-d19e53a0fdfba5ec0f283ae86175a3af

@carbonrobot
Copy link
Author

Using that IE11+ hack, works correctly:

// IE 11 hack to reverse the iOS temporal input hack
_:-ms-fullscreen, :root input[type="date"],
_:-ms-fullscreen, :root input[type="time"],
_:-ms-fullscreen, :root input[type="datetime-local"],
_:-ms-fullscreen, :root input[type="month"] {
    line-height: @line-height-base;

    &.input-sm {
        line-height: @input-height-small;
    }
    &.input-lg {
        line-height: @input-height-large;
    }
}

@mdo
Copy link
Member

mdo commented Aug 2, 2014

Lol, so wait, we have to hack IE8-10, and then unhack it for IE11? Holy hell, that sucks.

@mdo
Copy link
Member

mdo commented Aug 3, 2014

Neither of those hacks seem to solve it for me.

@mdo
Copy link
Member

mdo commented Aug 3, 2014

Nevermind, I'm a dingus and overlooked the code snippet above—the other values needed to begin with @line- as well. All set in http://jsbin.com/tuwoti/2/.

@cvrebert
Copy link
Collaborator

cvrebert commented Aug 3, 2014

@mdo If I'm understanding correctly, IE11 is behaving differently from the other modern browsers here, which probably means it has a bug that we ought to report?

@mdo
Copy link
Member

mdo commented Aug 3, 2014

Possibly? Have we reported any other bugs for IE yet?

@cvrebert
Copy link
Collaborator

cvrebert commented Aug 3, 2014

@mdo Yup: #14211 (comment)

@cvrebert
Copy link
Collaborator

Reopening to remind us to file an IE11 bug.

@cvrebert cvrebert reopened this Sep 26, 2014
@mdo
Copy link
Member

mdo commented Oct 26, 2014

Thinking about it more, I'm not really sure there is a bug for IE11 here. We're using CSS hacks to target IE 8-10, but I'm guessing that gets applied to IE11, too.

@carbonrobot
Copy link
Author

If IE 11 should be ignoring "\0", then its a bug. If "\0" is valid, then it's not a bug, only a problem with the hack were using to correct issues with IE 8 - 10. I wonder if using the full "\0/" would work better?

@mdo
Copy link
Member

mdo commented Oct 27, 2014

The change to the hack has no effect on IE11—the problem still exists.

@carasmo
Copy link

carasmo commented Oct 27, 2014

Just wondering why you can't just remove the IOS temporal inputs and put them, without the IE \0 hack into a webkit media query hack, it doesn't bug out in IE 11 and Chrome doesn't look crappy either.

SEE: http://jsfiddle.net/s97j14y3/1/

@media screen and (-webkit-min-device-pixel-ratio:0) { 
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="month"] {
        line-height: 34px
    }
    input[type="date"].input-sm,
    input[type="time"].input-sm,
    input[type="datetime-local"].input-sm,
    input[type="month"].input-sm {
        line-height: 30px
    }
    input[type="date"].input-lg,
    input[type="time"].input-lg,
    input[type="datetime-local"].input-lg,
    input[type="month"].input-lg {
        line-height: 46px
    }
}

@carasmo
Copy link

carasmo commented Oct 27, 2014

Just saw the comment in the less file. Nice verb usage. ; - )

@mdo mdo modified the milestones: v3.3.0, v3.3.1 Oct 29, 2014
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
… for IE11 for temporal inputs and line-height
@mdo
Copy link
Member

mdo commented Nov 9, 2014

@carasmo Nice! For some reason I was so hooked on it being IE that I didn't think about the original problem and how we could scope that. Thanks! Fix forthcoming.

@mdo mdo closed this as completed in 46d1bf8 Nov 9, 2014
@carbonrobot
Copy link
Author

@carasmo Nice fix, good focus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants