Merge pull request #17375 from calixteman/bug1867588
[Editor] Always give the focus to the ink editor when starting drawing (bug 1867588)
This commit is contained in:
commit
795c63e400
@ -660,10 +660,7 @@ class InkEditor extends AnnotationEditor {
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (
|
if (!this.div.contains(document.activeElement)) {
|
||||||
event.pointerType !== "mouse" &&
|
|
||||||
!this.div.contains(document.activeElement)
|
|
||||||
) {
|
|
||||||
this.div.focus({
|
this.div.focus({
|
||||||
preventScroll: true /* See issue #17327 */,
|
preventScroll: true /* See issue #17327 */,
|
||||||
});
|
});
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
closePages,
|
closePages,
|
||||||
|
getEditorSelector,
|
||||||
getSelectedEditors,
|
getSelectedEditors,
|
||||||
kbRedo,
|
kbRedo,
|
||||||
kbSelectAll,
|
kbSelectAll,
|
||||||
@ -256,4 +257,44 @@ describe("Ink Editor", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Ink editor must be committed when blurred", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must check that the ink editor is committed", async () => {
|
||||||
|
await Promise.all(
|
||||||
|
pages.map(async ([browserName, page]) => {
|
||||||
|
await page.click("#editorInk");
|
||||||
|
await page.waitForSelector(".annotationEditorLayer.inkEditing");
|
||||||
|
|
||||||
|
const rect = await page.$eval(".annotationEditorLayer", el => {
|
||||||
|
// With Chrome something is wrong when serializing a DomRect,
|
||||||
|
// hence we extract the values and just return them.
|
||||||
|
const { x, y } = el.getBoundingClientRect();
|
||||||
|
return { x, y };
|
||||||
|
});
|
||||||
|
|
||||||
|
const x = rect.x + 20;
|
||||||
|
const y = rect.y + 20;
|
||||||
|
const clickPromise = waitForPointerUp(page);
|
||||||
|
await page.mouse.move(x, y);
|
||||||
|
await page.mouse.down();
|
||||||
|
await page.mouse.move(x + 50, y + 50);
|
||||||
|
await page.mouse.up();
|
||||||
|
await clickPromise;
|
||||||
|
|
||||||
|
page.mouse.click(rect.x - 10, rect.y + 10);
|
||||||
|
await page.waitForSelector(`${getEditorSelector(0)}.disabled`);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user