chore: ignore checkbox/radio value in aria

This commit is contained in:
Pavel Feldman 2024-12-10 13:25:47 -08:00
parent 54c595c7ed
commit 9441768992
2 changed files with 16 additions and 2 deletions

View file

@ -158,8 +158,10 @@ function toAriaNode(element: Element): AriaNode | null {
if (roleUtils.kAriaSelectedRoles.includes(role)) if (roleUtils.kAriaSelectedRoles.includes(role))
result.selected = roleUtils.getAriaSelected(element); result.selected = roleUtils.getAriaSelected(element);
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
if (element.type !== 'checkbox' && element.type !== 'radio')
result.children = [element.value]; result.children = [element.value];
}
return result; return result;
} }

View file

@ -421,6 +421,18 @@ it('should treat input value as text in templates', async ({ page }) => {
`); `);
}); });
it('should not use on as checkbox value', async ({ page }) => {
await page.setContent(`
<input type='checkbox'>
<input type='radio'>
`);
await checkAndMatchSnapshot(page.locator('body'), `
- checkbox
- radio
`);
});
it('should respect aria-owns', async ({ page }) => { it('should respect aria-owns', async ({ page }) => {
await page.setContent(` await page.setContent(`
<a href='about:blank' aria-owns='input p'> <a href='about:blank' aria-owns='input p'>