vue-scrollto icon indicating copy to clipboard operation
vue-scrollto copied to clipboard

Scrolling canceled on triggering scroll with keyboard

Open rchl opened this issue 6 years ago • 1 comments
trafficstars

With either:

<a href="#" v-scroll-to="'#anchor'">Scroll</a>

or triggering scroll programatically from click event:

<a href="#" @click="VueScrollTo.scrollTo('#anchro')">Scroll</a>

If the scroll is triggered using keyboard (enter button), the scroll will be canceled right after it started. This is because keyup event cancels scroll.

I know I can set cancelable: false but that's not ideal as it makes sense for some keys to cancel scroll (arrows, spacebar, escape).

Options for resolving this: a. Check only for specific buttons that should be able to cancel. b. Don't cancel if keyup matches the same button that triggered keydown (might be tricky as it's click event that triggers scroll typically). c. Maybe trigger scroll from delay ($nextTick?) so that it triggers after keyup event. d. ???

rchl avatar Mar 19 '19 15:03 rchl

@rchl ... bit late to this, my solution in the end was simply to fire the events from keyup instead, it still feels responsive to me.

simonhrogers avatar Sep 19 '22 17:09 simonhrogers