Skip to content

Commit 1ee5689

Browse files
committed
Consistency, macOS compatability
1 parent 7054030 commit 1ee5689

File tree

5 files changed

+7
-18
lines changed

5 files changed

+7
-18
lines changed

special-pages/pages/new-tab/app/favorites/integration-tests/favorites.page.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ export class FavoritesPage {
2020

2121
async opensInNewTab() {
2222
await this.nthFavorite(0).click({ modifiers: ['Meta'] });
23+
await this.nthFavorite(0).click({ button: 'middle' });
2324
const calls = await this.ntp.mocks.waitForCallCount({ method: 'favorites_open', count: 1 });
2425
expect(calls[0].payload.params).toStrictEqual({ id: 'id-many-1', url: 'https://example.com/?id=id-many-1', target: 'new-tab' });
26+
expect(calls[1].payload.params).toStrictEqual({ id: 'id-many-1', url: 'https://example.com/?id=id-many-1', target: 'new-tab' });
2527
}
2628

2729
async opensInNewWindow() {
@@ -32,16 +34,6 @@ export class FavoritesPage {
3234
expect(calls[1].payload.params).toStrictEqual({ id: 'id-many-1', url: 'https://example.com/?id=id-many-1', target: 'new-window' });
3335
}
3436

35-
async opensInBackgroundTab() {
36-
await this.nthFavorite(0).click({ button: 'middle' });
37-
const calls = await this.ntp.mocks.waitForCallCount({ method: 'favorites_open', count: 1 });
38-
expect(calls[0].payload.params).toStrictEqual({
39-
id: 'id-many-1',
40-
url: 'https://example.com/?id=id-many-1',
41-
target: 'background-tab',
42-
});
43-
}
44-
4537
async opensInSameTab() {
4638
await this.nthFavorite(0).click();
4739
const calls = await this.ntp.mocks.waitForCallCount({ method: 'favorites_open', count: 1 });

special-pages/pages/new-tab/app/utils.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ export function eventToTarget(event, platformName) {
7373
} else if (event.shiftKey) {
7474
return 'new-window';
7575
} else if (event.button === 1 /* middle click */) {
76-
if (platformName === 'windows') {
77-
return 'background-tab';
78-
}
79-
return 'new-window';
76+
return 'new-tab';
8077
}
8178
return 'same-tab';
8279
}

special-pages/pages/new-tab/messages/types/open-target.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"title": "Open Target",
44
"type": "string",
5-
"enum": ["same-tab", "new-tab", "new-window", "background-tab"]
5+
"enum": ["same-tab", "new-tab", "new-window"]
66
}

special-pages/pages/new-tab/types/new-tab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @module NewTab Messages
77
*/
88

9-
export type OpenTarget = "same-tab" | "new-tab" | "new-window" | "background-tab";
9+
export type OpenTarget = "same-tab" | "new-tab" | "new-window";
1010
/**
1111
* Represents the expansion state of a widget
1212
*/

special-pages/shared/handlers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
export function eventToTarget(event, platformName) {
77
const isControlClick = platformName === 'macos' ? event.metaKey : event.ctrlKey;
8-
if (isControlClick) {
8+
if (isControlClick || ('button' in event && event.button === 1) /* middle click */) {
99
return 'new-tab';
10-
} else if (event.shiftKey || ('button' in event && event.button === 1) /* middle click */) {
10+
} else if (event.shiftKey) {
1111
return 'new-window';
1212
}
1313
return 'same-tab';

0 commit comments

Comments
 (0)