Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: right click on selected items deselects them

Abdullah Atta89123c0be560
diff --git a/apps/web/__e2e__/keyboard-list-navigation.test.ts b/apps/web/__e2e__/keyboard-list-navigation.test.ts
index 4d97d8035..dac660c97 100644
--- a/apps/web/__e2e__/keyboard-list-navigation.test.ts
+++ b/apps/web/__e2e__/keyboard-list-navigation.test.ts
@@ -50,6 +50,20 @@ test("ctrl+a should select all notes", async ({ page }) => {
}
});
+test("right clicking on selected notes should open multi-selection menu", async ({
+ page
+}) => {
+ const { notesList, notes } = await populateList(page);
+ await notes.focus();
+ await notes.press("Control+a");
+
+ await notesList[1].contextMenu.open();
+
+ expect(await notesList[1].contextMenu.title()).toBe(
+ `${notesList.length} items selected`
+ );
+});
+
test("pressing Escape should deselect all items", async ({ page }) => {
const { notesList, notes } = await populateList(page);
await notes.focus();
diff --git a/apps/web/__e2e__/models/context-menu.model.ts b/apps/web/__e2e__/models/context-menu.model.ts
index 821c56ecb..b2a1e859c 100644
--- a/apps/web/__e2e__/models/context-menu.model.ts
+++ b/apps/web/__e2e__/models/context-menu.model.ts
@@ -21,10 +21,18 @@ import { Page, Locator } from "@playwright/test";
import { getTestId } from "../utils";
export class ContextMenuModel {
- constructor(private readonly page: Page) {}
+ readonly titleText: Locator;
+ constructor(private readonly page: Page) {
+ this.titleText = this.page.locator(getTestId(`menu-title`));
+ }
+
+ async title() {
+ return await this.titleText.textContent();
+ }
async open(locator: Locator) {
await locator.click({ button: "right" });
+ await this.titleText.waitFor();
}
async clickOnItem(id: string) {
diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.ts
index 88975ddcf..eaf23fdc3 100644
--- a/apps/web/__e2e__/models/note-properties.model.ts
+++ b/apps/web/__e2e__/models/note-properties.model.ts
@@ -299,6 +299,10 @@ export class NoteContextMenuModel extends BaseProperties {
async close() {
await this.menu.close();
}
+
+ title() {
+ return this.menu.title();
+ }
}
class SessionHistoryItemModel {
diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.js
index b5e2f10e7..35c3ba9a6 100644
--- a/apps/web/src/components/menu/index.js
+++ b/apps/web/src/components/menu/index.js
@@ -243,6 +243,7 @@ function MenuContainer({ title, children }) {
fontFamily: "body",
color: "primary"
}}
+ data-test-id="menu-title"
>
{title}
</Text>
diff --git a/apps/web/src/hooks/use-keyboard-list-navigation.ts b/apps/web/src/hooks/use-keyboard-list-navigation.ts
index 525802b61..ea2f7292b 100644
--- a/apps/web/src/hooks/use-keyboard-list-navigation.ts
+++ b/apps/web/src/hooks/use-keyboard-list-navigation.ts
@@ -95,8 +95,7 @@ export function useKeyboardListNavigation(
}
bulkSelect(indices);
focusItemAt(endIndex);
- // (item.firstElementChild as HTMLElement)?.focus();
- } else {
+ } else if (e.button === 0) {
resetSelection();
select(itemIndex);
}