Skip to content

Commit 2dde5bb

Browse files
LinusBorgyyx990803
authored andcommitted
don't trigger transition when control keys or other mouse buttons are used. (#758)
1 parent 541a543 commit 2dde5bb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/link.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ export default {
4040

4141
const on = {
4242
click: (e) => {
43+
// don't redirect with control keys
44+
/* istanbul ignore if */
45+
if (e.metaKey || e.ctrlKey || e.shiftKey) return
46+
// don't redirect when preventDefault called
47+
/* istanbul ignore if */
48+
if (e.defaultPrevented) return
49+
// don't redirect on right click
50+
/* istanbul ignore if */
51+
if (e.button !== 0) return
4352
e.preventDefault()
4453
if (this.replace) {
4554
router.replace(to)

0 commit comments

Comments
 (0)