66 'has-province': hasSelected && provinces.length && provinces[0].province
77 }" >
88 <div class =" search-container" >
9- <div class =" countries-wrapper" >
9+ <div class =" countries-wrapper" :class = " { 'is-focused': focusedInput } " >
1010 <input
1111 ref =" countries"
1212 type =" text"
1515 @keydown.enter =" enter"
1616 @keydown.down =" down"
1717 @keydown.up =" up"
18+ @focus =" focusedInput = true"
19+ @blur =" focusedInput = false"
1820 @input =" change"
1921 />
2022 </div >
21- <div class =" provinces-wrapper" >
23+ <div class =" provinces-wrapper" :class = " { 'is-focused': focusedSelect } " >
2224 <select
2325 ref =" provinces"
24- @focus =" onFocus"
26+ :tabindex =" focusedSelect ? '0' : '-1'"
27+ @focus =" focusedSelect = true"
28+ @blur =" focusedSelect = false"
2529 @change =" onChange" >
2630 <option
2731 label =" Select State"
3741 </div >
3842 <button
3943 ref =" search"
40- :class =" { 'is-disabled': !hasSelected }"
44+ :class =" {
45+ 'is-disabled': !hasSelected,
46+ 'is-focused': focusedButton
47+ }"
4148 :disabled =" !hasSelected"
49+ @focus =" focusedButton = true"
50+ @blur =" focusedButton = false"
4251 @click =" onSearch" >
4352 <svg xmlns =" http://www.w3.org/2000/svg" x =" 0px" y =" 0px"
4453 width =" 30" height =" 30"
@@ -108,7 +117,10 @@ export default {
108117 provinces: [],
109118 locationId: null ,
110119 tempValue: null ,
111- hasSelected: false
120+ hasSelected: false ,
121+ focusedInput: false ,
122+ focusedSelect: false ,
123+ focusedButton: false
112124 }
113125 },
114126 methods: {
@@ -126,9 +138,7 @@ export default {
126138 event_label: ' input enter' ,
127139 value: this .country
128140 })
129- this .$nextTick (_ => {
130- if (this .isProvinceFocus ) this .$refs .provinces .focus ()
131- })
141+ if (this .isProvinceFocus ) this .$refs .provinces .focus ()
132142 }
133143 },
134144 up () {
@@ -163,9 +173,7 @@ export default {
163173 this .tempValue = this .country
164174 this .open = false
165175 this .hasSelected = true
166- if (this .isProvinceFocus ) {
167- this .$refs .provinces .focus ()
168- }
176+ if (this .isProvinceFocus ) this .$refs .provinces .focus ()
169177 this .$gtag (' event' , ' click' , {
170178 event_category: ' select' ,
171179 event_label: ' select click' ,
@@ -184,7 +192,7 @@ export default {
184192 })
185193 })
186194 },
187- onFocus (e ) {
195+ onSelectFocus (e ) {
188196 if (e .target .value ) {
189197 this .locationId = e .target .value
190198 this .$gtag (' event' , ' focus' , {
@@ -231,13 +239,26 @@ export default {
231239
232240 & .is-open {
233241
242+ & .has-selected {
243+
244+ & .has-province {
245+
246+ .dropdown-menu {
247+ transform : translateY (calc (-100% - 104px ));
248+ }
249+ }
250+
251+ .dropdown-menu {
252+ transform : translateY (calc (-100% - 54px ));
253+ }
254+ }
255+
234256 .countries-wrapper {
235257 border-radius : 0 0 4px 4px ;
236258 }
237259
238260 .dropdown-menu {
239261 display : block ;
240- border-radius : 4px 4px 0 0 ;
241262 }
242263 }
243264
@@ -255,7 +276,7 @@ export default {
255276 .provinces-wrapper {
256277 border-radius : 4px 4px 0 0 ;
257278 box-shadow : none ;
258- transform : translateY (0 % );
279+ transform : translateY (3 px );
259280 }
260281 }
261282
@@ -266,7 +287,8 @@ export default {
266287 }
267288
268289 .provinces-wrapper {
269- transform : translateY (-2px );
290+ box-shadow : 0px 6px 2px -1px rgba (0 , 0 , 0 , 0.2 );
291+ transform : translateY (0 );
270292 }
271293 }
272294
@@ -278,14 +300,30 @@ export default {
278300 color : #f2f2f2 ;
279301 border-radius : 4px ;
280302 padding : 8px 16px ;
303+ display : flex ;
304+ justify-content : center ;
305+ align-items : center ;
281306 width : 100% ;
282307 height : 52px ;
283308 font-size : 18px ;
284309 background-color : #3232ff ;
285310 box-shadow : 0px 6px 2px -1px rgba (0 , 0 , 0 , 0.2 );
286311 opacity : 1 ;
287- transition : 0.5s ease ;
288312 cursor : pointer ;
313+ outline : none ;
314+
315+ svg {
316+ transform : scale (0.8 );
317+ transition : 0.6s cubic-bezier (0.83 , 0 , 0.17 , 1 );
318+ }
319+
320+ & .is-focused {
321+ background-color : #1919ff ;
322+
323+ svg {
324+ transform : scale (1.2 );
325+ }
326+ }
289327
290328 & .is-disabled {
291329 opacity : 0.2 ;
@@ -301,8 +339,8 @@ export default {
301339 border-radius : 4px ;
302340 margin : 0 auto ;
303341 padding : 12px 16px ;
304- background-color : #ffffff ;
305- box-shadow : 0 px 6 px 2 px -1 px rgba ( 0 , 0 , 0 , 0.2 ) ;
342+ height : 28 px ;
343+ background-color : #dddddd ;
306344 transform : translateY (100% );
307345 transition : 0.6s cubic-bezier (0.83 , 0 , 0.17 , 1 );
308346
@@ -316,9 +354,14 @@ export default {
316354 background-color : transparent ;
317355 outline : none ;
318356 }
357+
358+ & .is-focused {
359+ background-color : #ffffff ;
360+ }
319361 }
320362
321363 .countries-wrapper {
364+ box-shadow : 0px 6px 2px -1px rgba (0 , 0 , 0 , 0.2 );
322365 transform : translateY (calc (200% + 2px ));
323366
324367 @media only screen and (min-width : 768px ) {
@@ -328,12 +371,13 @@ export default {
328371
329372 .provinces-wrapper {
330373 transform : translateY (calc (100% - 1px ));
331- z-index : 6 ;
374+ z-index : 8 ;
332375 }
333376
334377 .dropdown-menu {
335378 position : absolute ;
336379 top : calc (100% - 56px );
380+ border-radius : 4px ;
337381 margin : 0 ;
338382 padding : 0 ;
339383 display : none ;
0 commit comments