fix(aria): disregard text area textContent (#34544)
This commit is contained in:
parent
4b5b326478
commit
eff5cd6dbb
|
@ -57,7 +57,8 @@ export function generateAriaTree(rootElement: Element): AriaSnapshot {
|
||||||
|
|
||||||
if (node.nodeType === Node.TEXT_NODE && node.nodeValue) {
|
if (node.nodeType === Node.TEXT_NODE && node.nodeValue) {
|
||||||
const text = node.nodeValue;
|
const text = node.nodeValue;
|
||||||
if (text)
|
// <textarea>AAA</textarea> should not report AAA as a child of the textarea.
|
||||||
|
if (ariaNode.role !== 'textbox' && text)
|
||||||
ariaNode.children.push(node.nodeValue || '');
|
ariaNode.children.push(node.nodeValue || '');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,3 +605,16 @@ it('should escape special yaml values', async ({ page }) => {
|
||||||
- textbox: "555"
|
- textbox: "555"
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not report textarea textContent', async ({ page }) => {
|
||||||
|
await page.setContent(`<textarea>Before</textarea>`);
|
||||||
|
await checkAndMatchSnapshot(page.locator('body'), `
|
||||||
|
- textbox: Before
|
||||||
|
`);
|
||||||
|
await page.evaluate(() => {
|
||||||
|
document.querySelector('textarea').value = 'After';
|
||||||
|
});
|
||||||
|
await checkAndMatchSnapshot(page.locator('body'), `
|
||||||
|
- textbox: After
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue