Skip to content

Commit

Permalink
move it out of the body
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelEinbinder committed Aug 21, 2020
1 parent db6f85a commit 4f5f533
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class Keyboard {
}

async _updateKeyboardIndicator(description?: KeyDescription) {
if (!this._page._browserContext._browserBase._options.showKeyboardIndicator)
if (!this._page._browserContext._browser._options.showKeyboardIndicator)
return;
let text;
let dim = true;
Expand All @@ -76,7 +76,7 @@ export class Keyboard {

async _renderKeyboardIndicator(text: string, dim = false) {
(await this._page.mainFrame()._utilityContext()).evaluateInternal(({text, dim}) => {
const element: HTMLElement = document.querySelector('body > playwright-keyboard-indicator') || createKeyboardIndicator();
const element: HTMLElement = document.querySelector(':scope > playwright-keyboard-indicator') || createKeyboardIndicator();
(element as any).__setText(text, dim);

function createKeyboardIndicator() {
Expand Down Expand Up @@ -126,7 +126,7 @@ export class Keyboard {
}
div.classList.toggle('dim', dim);
};
document.body.appendChild(element);
document.documentElement.appendChild(element);
return element;
}
}, {text, dim}).catch(e => void 0);
Expand Down Expand Up @@ -269,11 +269,11 @@ export class Mouse {
}

async _updateMouseIndicator() {
if (!this._page._browserContext._browserBase._options.showMouseIndicator)
if (!this._page._browserContext._browser._options.showMouseIndicator)
return;
const args = [this._x, this._y, !!this._buttons.size] as const;
(await this._page.mainFrame()._utilityContext()).evaluateInternal(([x, y, pressed]) => {
const element: HTMLElement = document.querySelector('body > playwright-mouse-indicator') || createMouseIndicator();
const element: HTMLElement = document.querySelector(':scope > playwright-mouse-indicator') || createMouseIndicator();
element.style.left = x + 'px';
element.style.top = y + 'px';
element.classList.toggle('pressed', pressed);
Expand Down Expand Up @@ -306,7 +306,7 @@ export class Mouse {
element.style.position = 'fixed';
element.style.pointerEvents = 'none';
element.style.zIndex = String(Number.MAX_SAFE_INTEGER - 1);
document.body.appendChild(element);
document.documentElement.appendChild(element);
return element;
}
}, args);
Expand Down
2 changes: 1 addition & 1 deletion test/mouse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ it('should dblclick the div', async({page, server}) => {
expect(event.button).toBe(0);
});

it('should select the text with mouse', async({page, server}) => {
fit('should select the text with mouse', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');
await page.focus('textarea');
const text = 'This is the text that we are going to try to select. Let\'s see how it goes.';
Expand Down

0 comments on commit 4f5f533

Please sign in to comment.