Skip to content

Commit

Permalink
Fix preact-iso intercepting cmd/ctrl + click
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Sep 2, 2021
1 parent 1790e0f commit 21bbeb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-dolphins-walk.md
@@ -0,0 +1,5 @@
---
'preact-iso': patch
---

Fix `preact-iso` intercepting `cmd/ctrl+click` and other native browser behaviors.
5 changes: 5 additions & 0 deletions packages/preact-iso/router.js
Expand Up @@ -5,6 +5,11 @@ let push;
const UPDATE = (state, url) => {
push = undefined;
if (url && url.type === 'click') {
// ignore events the browser takes care of already:
if (url.ctrlKey || url.metaKey || url.altKey || url.shiftKey || url.button !== 0) {
return;
}

const link = url.target.closest('a[href]');
if (
!link ||
Expand Down

0 comments on commit 21bbeb9

Please sign in to comment.