mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: content editable retarget (#29792)
If `contenteditable` is wrapped into a button or `[role=button]`, `element.fill` will incorrectly retarget the closest button element. fix https://github.com/microsoft/playwright/issues/29813
This commit is contained in:
parent
1602548c10
commit
cc881fdb1f
@ -459,7 +459,7 @@ export class InjectedScript {
|
|||||||
return null;
|
return null;
|
||||||
if (behavior === 'none')
|
if (behavior === 'none')
|
||||||
return element;
|
return element;
|
||||||
if (!element.matches('input, textarea, select')) {
|
if (!element.matches('input, textarea, select') && !(element as any).isContentEditable) {
|
||||||
if (behavior === 'button-link')
|
if (behavior === 'button-link')
|
||||||
element = element.closest('button, [role=button], a, [role=link]') || element;
|
element = element.closest('button, [role=button], a, [role=link]') || element;
|
||||||
else
|
else
|
||||||
|
@ -250,7 +250,7 @@ it('input value retargeting', async ({ page, browserName }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it.fixme('selection retargeting', async ({ page, browserName }) => {
|
it('selection retargeting', async ({ page, browserName }) => {
|
||||||
const cases = [
|
const cases = [
|
||||||
{ dom: domStandalone(`<div contenteditable id=target>content</div>`), locator: 'div' },
|
{ dom: domStandalone(`<div contenteditable id=target>content</div>`), locator: 'div' },
|
||||||
{ dom: domInButton(`<div contenteditable id=target>content</div>`), locator: 'div' },
|
{ dom: domInButton(`<div contenteditable id=target>content</div>`), locator: 'div' },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user