diff --git a/special-pages/pages/history/integration-tests/history.page.js b/special-pages/pages/history/integration-tests/history.page.js index a709b6aebe..ed827264bb 100644 --- a/special-pages/pages/history/integration-tests/history.page.js +++ b/special-pages/pages/history/integration-tests/history.page.js @@ -204,7 +204,7 @@ export class HistoryTestPage { expect(calls[3].payload.params).toStrictEqual({ url, - target: 'new-window', + target: 'new-tab', }); } diff --git a/special-pages/pages/new-tab/app/activity/integration-tests/activity.page.js b/special-pages/pages/new-tab/app/activity/integration-tests/activity.page.js index 290c585bf3..bc7dc3c95a 100644 --- a/special-pages/pages/new-tab/app/activity/integration-tests/activity.page.js +++ b/special-pages/pages/new-tab/app/activity/integration-tests/activity.page.js @@ -213,7 +213,7 @@ export class ActivityPage { expect(calls[3].payload.params).toStrictEqual({ url, - target: 'new-window', + target: 'new-tab', }); } diff --git a/special-pages/pages/new-tab/app/favorites/integration-tests/favorites.page.js b/special-pages/pages/new-tab/app/favorites/integration-tests/favorites.page.js index 12585ac2ad..9488f445a7 100644 --- a/special-pages/pages/new-tab/app/favorites/integration-tests/favorites.page.js +++ b/special-pages/pages/new-tab/app/favorites/integration-tests/favorites.page.js @@ -20,16 +20,16 @@ export class FavoritesPage { async opensInNewTab() { await this.nthFavorite(0).click({ modifiers: ['Meta'] }); + await this.nthFavorite(0).click({ button: 'middle' }); const calls = await this.ntp.mocks.waitForCallCount({ method: 'favorites_open', count: 1 }); expect(calls[0].payload.params).toStrictEqual({ id: 'id-many-1', url: 'https://example.com/?id=id-many-1', target: 'new-tab' }); + expect(calls[1].payload.params).toStrictEqual({ id: 'id-many-1', url: 'https://example.com/?id=id-many-1', target: 'new-tab' }); } async opensInNewWindow() { await this.nthFavorite(0).click({ modifiers: ['Shift'] }); - await this.nthFavorite(0).click({ button: 'middle' }); - const calls = await this.ntp.mocks.waitForCallCount({ method: 'favorites_open', count: 2 }); + const calls = await this.ntp.mocks.waitForCallCount({ method: 'favorites_open', count: 1 }); expect(calls[0].payload.params).toStrictEqual({ id: 'id-many-1', url: 'https://example.com/?id=id-many-1', target: 'new-window' }); - expect(calls[1].payload.params).toStrictEqual({ id: 'id-many-1', url: 'https://example.com/?id=id-many-1', target: 'new-window' }); } async opensInSameTab() { diff --git a/special-pages/pages/new-tab/app/utils.js b/special-pages/pages/new-tab/app/utils.js index 5bcd1bd1c2..21d3a0ab2d 100644 --- a/special-pages/pages/new-tab/app/utils.js +++ b/special-pages/pages/new-tab/app/utils.js @@ -70,8 +70,10 @@ export function eventToTarget(event, platformName) { const isControlClick = platformName === 'macos' ? event.metaKey : event.ctrlKey; if (isControlClick) { return 'new-tab'; - } else if (event.shiftKey || event.button === 1 /* middle click */) { + } else if (event.shiftKey) { return 'new-window'; + } else if (event.button === 1 /* middle click */) { + return 'new-tab'; } return 'same-tab'; } diff --git a/special-pages/shared/handlers.js b/special-pages/shared/handlers.js index b5b19523a5..0061bd8220 100644 --- a/special-pages/shared/handlers.js +++ b/special-pages/shared/handlers.js @@ -5,9 +5,9 @@ */ export function eventToTarget(event, platformName) { const isControlClick = platformName === 'macos' ? event.metaKey : event.ctrlKey; - if (isControlClick) { + if (isControlClick || ('button' in event && event.button === 1) /* middle click */) { return 'new-tab'; - } else if (event.shiftKey || ('button' in event && event.button === 1) /* middle click */) { + } else if (event.shiftKey) { return 'new-window'; } return 'same-tab';