Skip to content

Commit 9a5d666

Browse files
committed
Maintain stable height when selected
We need the selected-tag and input to have the same line height, and same border widths so the height of the content (either a selected-tag or the input) is stable. Otherwise the v-select will change height by a few pixels when a value is selected vs empty.
1 parent faa5481 commit 9a5d666

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/components/Select.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
-moz-appearance: none;
6868
appearance: none;
6969
display: flex;
70-
padding: 0;
70+
padding: 0 0 4px 0;
7171
background: none;
7272
border: 1px solid rgba(60, 60, 60, .26);
7373
border-radius: 4px;
@@ -86,7 +86,7 @@
8686
flex-basis: 100%;
8787
flex-grow: 1;
8888
flex-wrap: wrap;
89-
padding: 0 2px 4px;
89+
padding: 0 2px;
9090
}
9191
.v-select .v-select__actions {
9292
display: flex;
@@ -146,10 +146,11 @@
146146
.v-select .selected-tag {
147147
display: flex;
148148
align-items: center;
149-
color: #333;
150149
background-color: #f0f0f0;
151150
border: 1px solid #ccc;
152151
border-radius: 4px;
152+
color: #333;
153+
line-height: 1.42857143; /* Normalize line height */
153154
margin: 4px 2px 0px 2px;
154155
padding: 0 0.25em;
155156
}
@@ -196,12 +197,11 @@
196197
-moz-appearance: none;
197198
line-height: 1.42857143;
198199
font-size: 1em;
199-
height: auto;
200200
display: inline-block;
201-
border: none;
201+
border: 1px solid transparent;
202202
outline: none;
203-
margin: 0;
204-
padding: 0 .5em;
203+
margin: 4px 0 0 0;
204+
padding: 0 0.5em;
205205
max-width: 100%;
206206
background: none;
207207
box-shadow: none;
@@ -223,6 +223,7 @@
223223
cursor: pointer;
224224
}
225225
.v-select input[type="search"].hidden {
226+
border: none;
226227
height: 0;
227228
padding: 0;
228229
width: 0;

0 commit comments

Comments
 (0)