Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class HistoryTestPage {

expect(calls[3].payload.params).toStrictEqual({
url,
target: 'new-window',
target: 'new-tab',
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class ActivityPage {

expect(calls[3].payload.params).toStrictEqual({
url,
target: 'new-window',
target: 'new-tab',
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 3 additions & 1 deletion special-pages/pages/new-tab/app/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
4 changes: 2 additions & 2 deletions special-pages/shared/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading