mirror of
https://github.com/microsoft/playwright.git
synced 2024-10-27 05:46:28 +03:00
fix(accessibility): firefox with aria-invalid element (#29462)
Fixes https://github.com/microsoft/playwright/issues/29459
This commit is contained in:
parent
498b8bb269
commit
fe81790221
@ -245,7 +245,6 @@ class FFAXNode implements accessibility.AXNode {
|
||||
const tokenProperties: Array<keyof channels.AXNode & keyof Protocol.Accessibility.AXTree> = [
|
||||
'autocomplete',
|
||||
'haspopup',
|
||||
'invalid',
|
||||
'orientation',
|
||||
];
|
||||
for (const tokenProperty of tokenProperties) {
|
||||
@ -261,6 +260,8 @@ class FFAXNode implements accessibility.AXNode {
|
||||
axNode.checked = this._payload.checked === true ? 'checked' : this._payload.checked === 'mixed' ? 'mixed' : 'unchecked';
|
||||
if ('pressed' in this._payload)
|
||||
axNode.pressed = this._payload.pressed === true ? 'pressed' : 'released';
|
||||
if ('invalid' in this._payload)
|
||||
axNode.invalid = this._payload.invalid === true ? 'true' : 'false';
|
||||
return axNode;
|
||||
}
|
||||
}
|
||||
|
@ -348,3 +348,20 @@ it('should work when there is a title ', async ({ page }) => {
|
||||
expect(snapshot.name).toBe('This is the title');
|
||||
expect(snapshot.children[0].name).toBe('This is the content');
|
||||
});
|
||||
|
||||
it('should work with aria-invalid accessibility tree', async ({ page, browserName, server }) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent(`<a href="/hi" aria-invalid="true">WHO WE ARE</a>`);
|
||||
expect(await page.accessibility.snapshot()).toEqual({
|
||||
'role': browserName === 'firefox' ? 'document' : 'WebArea',
|
||||
'name': '',
|
||||
'children': [
|
||||
{
|
||||
'role': 'link',
|
||||
'name': 'WHO WE ARE',
|
||||
'invalid': 'true',
|
||||
'value': browserName === 'firefox' ? `${server.PREFIX}/hi` : undefined
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user