[Editor] Make the delete button clickable with the space key (bug 1882248)
This commit is contained in:
parent
7cc34cf4a7
commit
f52bf2836f
@ -711,7 +711,9 @@ class AnnotationEditorUIManager {
|
||||
// Those shortcuts can be used in the toolbar for some other actions
|
||||
// like zooming, hence we need to check if the container has the
|
||||
// focus.
|
||||
checker: self => self.#container.contains(document.activeElement),
|
||||
checker: (self, { target: el }) =>
|
||||
!(el instanceof HTMLButtonElement) &&
|
||||
self.#container.contains(document.activeElement),
|
||||
},
|
||||
],
|
||||
[["Escape", "mac+Escape"], proto.unselectAll],
|
||||
|
@ -1231,4 +1231,39 @@ describe("Highlight Editor", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Editor must be removed in using the space key on the delete button", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that the highlight has been deleted", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.click("#editorHighlight");
|
||||
await page.waitForSelector(".annotationEditorLayer.highlightEditing");
|
||||
|
||||
const rect = await getSpanRectFromText(page, 1, "Abstract");
|
||||
const x = rect.x + rect.width / 2;
|
||||
const y = rect.y + rect.height / 2;
|
||||
await page.mouse.click(x, y, { count: 2, delay: 100 });
|
||||
|
||||
await page.waitForSelector(getEditorSelector(0));
|
||||
await waitForSerialized(page, 1);
|
||||
await page.waitForSelector(`${getEditorSelector(0)} button.delete`);
|
||||
|
||||
await page.focus(`${getEditorSelector(0)} button.delete`);
|
||||
await page.keyboard.press(" ");
|
||||
|
||||
await waitForSerialized(page, 0);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user