File tree Expand file tree Collapse file tree 2 files changed +16
-13
lines changed
Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,6 @@ export default {
2929 zoom: 1.6
3030 })
3131
32- map .addControl (new mapboxgl.NavigationControl ())
33-
3432 const addLayers = map => {
3533 map .addSource (' covid' , {
3634 type: ' geojson' ,
@@ -183,13 +181,6 @@ export default {
183181 width : 100% ;
184182 height : 100% ;
185183
186- .mapboxgl-ctrl-top-right {
187- .mapboxgl-ctrl {
188- margin-top : 24px ;
189- margin-right : 24px ;
190- }
191- }
192-
193184 .mapboxgl-ctrl-bottom-left {
194185 .mapboxgl-ctrl {
195186 margin : 0 0 16px 24px ;
Original file line number Diff line number Diff line change 4747 </svg >
4848 </button >
4949 </div >
50- <ul class =" dropdown-menu" >
50+ <ul ref = " dropdown " class =" dropdown-menu" >
5151 <li
5252 v-for =" (suggestion, index) in matches"
5353 :key =" index"
@@ -132,10 +132,16 @@ export default {
132132 }
133133 },
134134 up () {
135- if (this .current > 0 ) this .current --
135+ if (this .current > 0 ) {
136+ this .current --
137+ this .onKeyPress ()
138+ }
136139 },
137140 down () {
138- if (this .current < this .matches .length - 1 ) this .current ++
141+ if (this .current < this .matches .length - 1 ) {
142+ this .current ++
143+ this .onKeyPress ()
144+ }
139145 },
140146 isActive (index ) {
141147 return index === this .current
@@ -177,7 +183,6 @@ export default {
177183 value: this .locationId
178184 })
179185 })
180-
181186 },
182187 onFocus (e ) {
183188 if (e .target .value ) {
@@ -197,6 +202,13 @@ export default {
197202 event_label: ' province change' ,
198203 value: this .locationId
199204 })
205+ },
206+ onKeyPress () {
207+ this .$nextTick (_ => {
208+ const parentHeight = parseFloat (getComputedStyle (this .$refs .dropdown , null ).height .replace (' px' , ' ' ))
209+ this .$refs .dropdown .scrollTop = 0
210+ this .$refs .dropdown .scrollTop = (document .querySelector (' li.is-active' ).offsetTop + 40 ) - parentHeight
211+ })
200212 }
201213 }
202214}
You can’t perform that action at this time.
0 commit comments