Skip to content

Commit b1b7215

Browse files
committed
Fix #382 Typeahead display when using 16px vs 14px
1 parent 05b7c74 commit b1b7215

File tree

5 files changed

+93
-105
lines changed

5 files changed

+93
-105
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.scss]
12+
indent_size = 4
13+
indent_style = space

dist/jquery.typeahead.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"babel-core": "6.4.5",
3131
"babel-preset-es2015": "6.3.13",
3232
"gulp": "git://github.com/gulpjs/gulp.git#4.0",
33-
"gulp-autoprefixer": "3.1.0",
33+
"gulp-autoprefixer": "4.0.0",
3434
"gulp-cssnano": "^2.1.0",
3535
"gulp-jshint": "^2.0.1",
3636
"gulp-rename": "1.2.2",

src/jquery.typeahead.css

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170

171171
.typeahead__container {
172172
position: relative;
173-
font: 14px Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
173+
font: 1rem Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
174174
}
175175

176176
.typeahead__container * {
@@ -207,29 +207,13 @@
207207
}
208208

209209
.typeahead__field {
210-
font-size: 0;
210+
display: -webkit-flex;
211+
display: -ms-flexbox;
212+
display: flex;
211213
position: relative;
212-
display: table;
213-
border-collapse: collapse;
214214
width: 100%;
215215
}
216216

217-
.typeahead__field > * {
218-
display: table-cell;
219-
vertical-align: top;
220-
}
221-
222-
.typeahead__query, .typeahead__filter, .typeahead__button {
223-
font-size: 14px;
224-
}
225-
226-
.typeahead__button {
227-
position: relative;
228-
font-size: 0;
229-
width: 1%;
230-
vertical-align: top;
231-
}
232-
233217
.typeahead__button button {
234218
border-top-right-radius: 2px;
235219
border-bottom-right-radius: 2px;
@@ -245,9 +229,9 @@
245229
.typeahead__field .typeahead__hint {
246230
display: block;
247231
width: 100%;
248-
min-height: 36px;
249-
line-height: 1.6;
250-
padding: 6px 12px;
232+
line-height: 1.25;
233+
min-height: calc(0.5rem * 2 + 1.25rem + 2px);
234+
padding: 0.5rem 0.75rem;
251235
background: #fff;
252236
border: 1px solid #ccc;
253237
border-radius: 2px 0 0 2px;
@@ -298,8 +282,8 @@
298282
cursor: pointer;
299283
background-color: #fff;
300284
border: 1px solid #ccc;
301-
height: 36px;
302-
padding: 6px 12px;
285+
line-height: 1.25;
286+
padding: 0.5rem 0.75rem;
303287
-webkit-user-select: none;
304288
-moz-user-select: none;
305289
-ms-user-select: none;
@@ -415,7 +399,7 @@
415399
.typeahead__list > li > a,
416400
.typeahead__dropdown > li > a {
417401
display: block;
418-
padding: 6px 12px;
402+
padding: 0.5rem 0.75rem;
419403
clear: both;
420404
color: #333;
421405
text-decoration: none;
@@ -432,7 +416,7 @@
432416
}
433417

434418
.typeahead__list.empty > li {
435-
padding: 6px 12px;
419+
padding: 0.5rem 0.75rem;
436420
color: #333;
437421
}
438422

@@ -486,10 +470,8 @@
486470
position: absolute;
487471
right: 0;
488472
cursor: pointer;
489-
font-size: 18px;
490473
line-height: 1.25;
491-
height: 36px;
492-
padding: 6px 10px;
474+
padding: 0.5rem 0.75rem;
493475
visibility: hidden;
494476
}
495477

@@ -510,25 +492,23 @@
510492
padding: 0 1.25rem;
511493
width: 16px;
512494
height: 16px;
513-
text-align: center;
514-
display: inline-block;
515495
background: url(data:image/svg+xml;charset=utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTguMS4xLCBTVkcgRXh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jIzNWMwLTM3LjEzNCwzMC4xMDMtNjcuMjM2LDY3LjIzNi02Ny4yMzZjMzcuMTMyLDAsNjcuMjM1LDMwLjEwMyw2Ny4yMzUsNjcuMjM2ICAgQzE3MC4xNDYsMTQwLjA0NCwxNDAuMDQzLDE3MC4xNDYsMTAyLjkxMSwxNzAuMTQ2eiIgZmlsbD0iIzU1NTU1NSIvPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=) no-repeat scroll center center transparent;
516496
}
517497

518498
.typeahead__container.loading .typeahead__query:before, .typeahead__container.loading .typeahead__query:after {
519499
transition: all 0s linear, opacity 0.2s ease;
520500
position: absolute;
521501
z-index: 3;
522-
content: '';
502+
content: "";
523503
top: 50%;
524-
right: .55em;
525-
margin-top: -10.5px;
526-
width: 21px;
527-
height: 21px;
504+
right: 0.55em;
505+
margin-top: -0.675rem;
506+
width: 1.35rem;
507+
height: 1.35rem;
528508
box-sizing: border-box;
529509
border-radius: 500rem;
530510
border-style: solid;
531-
border-width: .1em;
511+
border-width: 0.1em;
532512
}
533513

534514
.typeahead__container.loading .typeahead__query:before {
@@ -569,33 +549,48 @@
569549
.typeahead__label-container {
570550
list-style: none;
571551
position: absolute;
572-
padding-top: 6px;
552+
padding-top: calc(1rem * 0.375);
573553
padding-left: 6px;
554+
width: 100%;
555+
-webkit-flex-wrap: wrap;
556+
-ms-flex-wrap: wrap;
557+
flex-wrap: wrap;
558+
display: -webkit-flex;
559+
display: -ms-flexbox;
560+
display: flex;
574561
}
575562

576563
.typeahead__label {
577-
font-size: 12px;
564+
display: -webkit-flex;
565+
display: -ms-flexbox;
566+
display: flex;
567+
font-size: calc(1rem * 0.875);
578568
position: relative;
579-
display: inline-block;
580569
background: #ecf5fc;
581570
border: solid 1px #c2e0ff;
582571
padding-left: 4px;
583572
border-radius: 2px;
584573
margin-right: 4px;
585-
margin-bottom: 6px;
574+
margin-bottom: calc(1rem * 0.375);
586575
}
587576

588577
.typeahead__label > * {
589-
display: inline-block;
578+
-webkit-align-self: center;
579+
-ms-flex-item-align: center;
580+
-ms-grid-row-align: center;
581+
align-self: center;
590582
}
591583

592584
.typeahead__label .typeahead__cancel-button {
593585
line-height: normal;
594586
height: auto;
595587
position: static;
596-
padding: 4px 6px;
588+
padding-top: calc(1rem * 0.25 - 1px);
589+
padding-bottom: calc(1rem * 0.25 + 1px);
590+
padding-left: 6px;
591+
padding-right: 6px;
597592
margin-left: 4px;
598-
font-size: 12px;
593+
font-size: calc(1rem * 0.875);
599594
border-left: solid 1px #c2e0ff;
600595
}
601596

0 commit comments

Comments
 (0)