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

select.form-control and input[type=text].form-control are different heights #17194

Closed
cvrebert opened this issue Aug 21, 2015 · 11 comments
Closed

Comments

@cvrebert
Copy link
Collaborator

No description provided.

@arthurbath
Copy link

Selects are a pain. Safari renders them with an undesirable background gradient, and Firefox attaches that awful Win98-esque dropdown button. But if you set appearance: none, they lose their up-down arrow indicators.

Here's an extension for select.form-control that I've been using that strips the appearance, then adds the dropdown indicator back via a base64 SVG (courtesy Entypo):

select.form-control {
  -moz-appearance: none;
  -webkit-appearance: none;
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMTBweCIgaGVpZ2h0PSIxOHB4IiB2aWV3Qm94PSIwIDAgMTAgMTgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sbnM6c2tldGNoPSJodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2gvbnMiPiAgICAgICAgPHRpdGxlPlVudGl0bGVkPC90aXRsZT4gICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+ICAgIDxkZWZzPjwvZGVmcz4gICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+ICAgICAgICA8ZyBpZD0ic2VsZWN0LWFycm93cyIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iIzAwMDAwMCI+ICAgICAgICAgICAgPHBhdGggZD0iTTUsMCBMMCw3IEwxMCw3IEw1LDAgTDUsMCBaIE01LDE4IEwxMCwxMSBMMCwxMSBMNSwxOCBMNSwxOCBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4gICAgICAgIDwvZz4gICAgPC9nPjwvc3ZnPg==);
  background-size: .5em;
  background-repeat: no-repeat;
  background-position: right .5em center;
  padding-right: 2em;
  overflow: hidden;
  text-overflow: ellipsis;
}

Got a little frustrated by the text abruptly cutting off at the padding line, so I also added the text-overflow: ellipsis, too, though it's not entirely necessary. Not sure if there are problems with this solution (screen readers?) that would make it unsuitable for official inclusion.

Chrome
chrome--after
Chrome (input-sm)
chrome--after--sm
Firefox
firefox--after
Safari
safari--after

@cvrebert
Copy link
Collaborator Author

@arthurbath What you're proposing is something more appropriate for the completely custom form controls (http://v4-alpha.getbootstrap.com/components/forms/#select-menu ), not our vanilla .form-control, which is supposed to be native-ish (well, as native as the browser engine itself allows).

@cvrebert
Copy link
Collaborator Author

cvrebert commented Nov 4, 2015

CC: @mdo

DataTables pushed a commit to DataTables/DataTablesSrc that referenced this issue Feb 1, 2016
- Bootstrap 4 is currently in beta so things can, and probably will
  still change. Bootstrap 4 packages for DataTables won't be made
  available until at least a beta release of Bootstrap 4.
- A few things have changed in Bootstrap 4 and rather than trying to
  make the exisiting Bootstrap files work for both BS3 and BS4 it makes
  sense to offer both. We'd need to detect which version of BS is loaded
  and that can be quite unreliable (and delayed since the body would
  need to be available).
- Pagingation requires a couple of classes, but no change in structure
- BS4 don't include icons any more, so need to use UTF8 arrows to show
  sorting (don't particularly want other dependencies, although it is
  easy to add with CSS if you want more icon control)
- Outstanding issue: The select element for paging control is not of a
  consistent height with the search input. This appears to be a
  Bootstrap issue: twbs/bootstrap#17194
DataTables pushed a commit to DataTables/Dist-DataTables that referenced this issue Feb 1, 2016
- Bootstrap 4 is currently in beta so things can, and probably will
  still change. Bootstrap 4 packages for DataTables won't be made
  available until at least a beta release of Bootstrap 4.
- A few things have changed in Bootstrap 4 and rather than trying to
  make the exisiting Bootstrap files work for both BS3 and BS4 it makes
  sense to offer both. We'd need to detect which version of BS is loaded
  and that can be quite unreliable (and delayed since the body would
  need to be available).
- Pagingation requires a couple of classes, but no change in structure
- BS4 don't include icons any more, so need to use UTF8 arrows to show
  sorting (don't particularly want other dependencies, although it is
  easy to add with CSS if you want more icon control)
- Outstanding issue: The select element for paging control is not of a
  consistent height with the search input. This appears to be a
  Bootstrap issue: twbs/bootstrap#17194

Sync to source repo @105ba6c24a7959ca63d1c9ccfbb32010babf52d8
DataTables pushed a commit to DataTables/Dist-DataTables-DataTables that referenced this issue Feb 1, 2016
- Bootstrap 4 is currently in beta so things can, and probably will
  still change. Bootstrap 4 packages for DataTables won't be made
  available until at least a beta release of Bootstrap 4.
- A few things have changed in Bootstrap 4 and rather than trying to
  make the exisiting Bootstrap files work for both BS3 and BS4 it makes
  sense to offer both. We'd need to detect which version of BS is loaded
  and that can be quite unreliable (and delayed since the body would
  need to be available).
- Pagingation requires a couple of classes, but no change in structure
- BS4 don't include icons any more, so need to use UTF8 arrows to show
  sorting (don't particularly want other dependencies, although it is
  easy to add with CSS if you want more icon control)
- Outstanding issue: The select element for paging control is not of a
  consistent height with the search input. This appears to be a
  Bootstrap issue: twbs/bootstrap#17194

Sync to source repo @105ba6c24a7959ca63d1c9ccfbb32010babf52d8
DataTables pushed a commit to DataTables/Dist-DataTables-Bootstrap that referenced this issue Feb 1, 2016
- Bootstrap 4 is currently in beta so things can, and probably will
  still change. Bootstrap 4 packages for DataTables won't be made
  available until at least a beta release of Bootstrap 4.
- A few things have changed in Bootstrap 4 and rather than trying to
  make the exisiting Bootstrap files work for both BS3 and BS4 it makes
  sense to offer both. We'd need to detect which version of BS is loaded
  and that can be quite unreliable (and delayed since the body would
  need to be available).
- Pagingation requires a couple of classes, but no change in structure
- BS4 don't include icons any more, so need to use UTF8 arrows to show
  sorting (don't particularly want other dependencies, although it is
  easy to add with CSS if you want more icon control)
- Outstanding issue: The select element for paging control is not of a
  consistent height with the search input. This appears to be a
  Bootstrap issue: twbs/bootstrap#17194

Sync to source repo @105ba6c24a7959ca63d1c9ccfbb32010babf52d8
DataTables pushed a commit to DataTables/Dist-DataTables-Foundation that referenced this issue Feb 1, 2016
- Bootstrap 4 is currently in beta so things can, and probably will
  still change. Bootstrap 4 packages for DataTables won't be made
  available until at least a beta release of Bootstrap 4.
- A few things have changed in Bootstrap 4 and rather than trying to
  make the exisiting Bootstrap files work for both BS3 and BS4 it makes
  sense to offer both. We'd need to detect which version of BS is loaded
  and that can be quite unreliable (and delayed since the body would
  need to be available).
- Pagingation requires a couple of classes, but no change in structure
- BS4 don't include icons any more, so need to use UTF8 arrows to show
  sorting (don't particularly want other dependencies, although it is
  easy to add with CSS if you want more icon control)
- Outstanding issue: The select element for paging control is not of a
  consistent height with the search input. This appears to be a
  Bootstrap issue: twbs/bootstrap#17194

Sync to source repo @105ba6c24a7959ca63d1c9ccfbb32010babf52d8
DataTables pushed a commit to DataTables/Dist-DataTables-jQueryUI that referenced this issue Feb 1, 2016
- Bootstrap 4 is currently in beta so things can, and probably will
  still change. Bootstrap 4 packages for DataTables won't be made
  available until at least a beta release of Bootstrap 4.
- A few things have changed in Bootstrap 4 and rather than trying to
  make the exisiting Bootstrap files work for both BS3 and BS4 it makes
  sense to offer both. We'd need to detect which version of BS is loaded
  and that can be quite unreliable (and delayed since the body would
  need to be available).
- Pagingation requires a couple of classes, but no change in structure
- BS4 don't include icons any more, so need to use UTF8 arrows to show
  sorting (don't particularly want other dependencies, although it is
  easy to add with CSS if you want more icon control)
- Outstanding issue: The select element for paging control is not of a
  consistent height with the search input. This appears to be a
  Bootstrap issue: twbs/bootstrap#17194

Sync to source repo @105ba6c24a7959ca63d1c9ccfbb32010babf52d8
DataTables pushed a commit to DataTables/DataTables that referenced this issue Feb 3, 2016
- Bootstrap 4 is currently in beta so things can, and probably will
  still change. Bootstrap 4 packages for DataTables won't be made
  available until at least a beta release of Bootstrap 4.
- A few things have changed in Bootstrap 4 and rather than trying to
  make the exisiting Bootstrap files work for both BS3 and BS4 it makes
  sense to offer both. We'd need to detect which version of BS is loaded
  and that can be quite unreliable (and delayed since the body would
  need to be available).
- Pagingation requires a couple of classes, but no change in structure
- BS4 don't include icons any more, so need to use UTF8 arrows to show
  sorting (don't particularly want other dependencies, although it is
  easy to add with CSS if you want more icon control)
- Outstanding issue: The select element for paging control is not of a
  consistent height with the search input. This appears to be a
  Bootstrap issue: twbs/bootstrap#17194
@mdo mdo added this to the v4.0.0-alpha.3 milestone Feb 7, 2016
@mdo
Copy link
Member

mdo commented Feb 7, 2016

Fixed in caa36b8.

@mdo mdo closed this as completed Feb 7, 2016
@cvrebert
Copy link
Collaborator Author

cvrebert commented Feb 8, 2016

@mdo Still not quite right (OS X Chrome):
select-height

@cvrebert cvrebert reopened this Feb 8, 2016
@eliottrobson
Copy link

Is this a similar issue to #18786 ?

@cvrebert
Copy link
Collaborator Author

@eliottrobson Only slightly.

@eliottrobson
Copy link

@cvrebert when I was looking at that issue I did notice that my changes did alter the height of the select element. But the way I did it isn't ideal, hard-coded heights etc... Is there any way we can apply the same logic but calculate the values?

@torbjoernk
Copy link

I might miss something, but does the addition introduced by caa36b8 have to be extended/duplicated for .form-control-sm and .form-control-lg with height: $input-height-sm; and height: $input-height-lg; respectively?

torbjoernk added a commit to torbjoernk/jlesc.github.io that referenced this issue Feb 23, 2016
These are mainly:
  - [#17194](twbs/bootstrap#17194)
  - [#18772](twbs/bootstrap#18772)
  - [#18782](twbs/bootstrap#18782)
  - [#19099](twbs/bootstrap#19099)
  - [#19102](twbs/bootstrap#19102)
  - [#19103](twbs/bootstrap#19103)

Signed-off-by: Torbjörn Klatt <t.klatt@fz-juelich.de>
@cvrebert
Copy link
Collaborator Author

@torbjoernk Quite possibly. See #19771.

@leetskills
Copy link

leetskills commented May 24, 2016

I found that the issue for me was the top & bottom border widths being added to the calculated height of text form controls, but not being part of the $input-height calculation. Would something like the below be a valid fix?

$input-height: (($font-size-base * $input-line-height) + ($input-padding-y * 2)) + ($input-btn-border-width * 2);

Note: in order to do this, I had to set $border-width to .0625rem (equivalent to 1px based on 16px $font-size-base.

I also used $input-line-height rather than $line-height-base, and applied these changes to the -sm/-lg variations, but the heights for those are still off as the calculated line height doesn't round to a whole number.

@mdo mdo modified the milestones: v4.0.0-alpha.3, v4.0.0-alpha.4 Jul 23, 2016
mdo added a commit that referenced this issue Oct 10, 2016
Uses a local variable and some calc love to counteract the border-width (times 2) from the height of the select. Fixes #17194 and nullifies #19967.
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

6 participants