stretchy icon indicating copy to clipboard operation
stretchy copied to clipboard

extra height on textboxes when `box-sizing: border-box` and `min-height` set

Open anfedorov opened this issue 8 years ago • 4 comments

http://codepen.io/anfedorov/pen/xqWPja

anfedorov avatar Mar 21 '17 22:03 anfedorov

Possible fix is to change line ~55 in test for "border-box":

     if (cs.boxSizing == "border-box") {
          offset = 10; // element.offsetHeight;
      } 

Setting offset to the original element.offsetHeight appears to be creating the extra height. Changing offset to 0 works, but a few extra pixels will help avoid having the scrollbar. Could be that it needs to be based on lineHeight.

(This suggestion replaces my recommendation for a conditional test as detailed on #23. It accomplishes the same thing.)

Update: http://codepen.io/anon/pen/XMEzxq

macfire avatar Mar 21 '17 22:03 macfire

sorry about confusion, long day.

I think the scroll bars you're talking about come from the border being set to something wider than default. for that issue and the one this ticket describes, this fix works in Chrome: https://gist.github.com/4b597ecc70e5556d271ffdc2a0099d63

could you please double check it against your examples before I test it in all browsers and make a pull request?

anfedorov avatar Mar 22 '17 03:03 anfedorov

seems to work: http://codepen.io/anfedorov/pen/zZWjEX

right?

anfedorov avatar Mar 22 '17 03:03 anfedorov

Yes. Both Safari and Firefox (Mac) test correctly.

Thanks.

macfire avatar Mar 22 '17 13:03 macfire