chore: ignore checkbox/radio value in aria (#33941)

This commit is contained in:
Pavel Feldman 2024-12-10 14:04:18 -08:00 committed by GitHub
parent 599b09c1c0
commit acf1107220
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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))
result.selected = roleUtils.getAriaSelected(element);
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement)
result.children = [element.value];
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
if (element.type !== 'checkbox' && element.type !== 'radio')
result.children = [element.value];
}
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 }) => {
await page.setContent(`
<a href='about:blank' aria-owns='input p'>