fix: support the <search> element in role queries - #1385
Conversation
The <search> element has an implicit ARIA role of search per the HTML-AAM
spec, but aria-query 5.3.0 does not map it, so getByRole("search") could
not find a <search> element and getImplicitAriaRoles returned [] for it.
Add <search> in the two places that consume the aria-query maps:
getImplicitAriaRoles (used to compute an element role) and makeRoleSelector
(used to build the candidate set for a role query). Both are gated behind
a comment noting they can be removed once aria-query maps <search>.
Fixes testing-library#1359
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a8714a5:
|
|
The I can't re-run the workflow from a fork PR — could a maintainer give it a re-run? And happy to open a separate PR pinning |
Closes #1359
The
<search>element has an implicit ARIA role ofsearchper the HTML-AAM spec, butaria-query@5.3.0doesn't map it. As a resultgetByRole('search')can't find a<search>element, andgetImplicitAriaRolesreturns[]for it.The fix adds
<search>in the two places that consume aria-query's maps:getImplicitAriaRoles(computes an element's implicit role)makeRoleSelector(builds the candidate set for a role query)Both are gated behind a comment noting they can be removed once aria-query maps
<search>. I found that patching onlygetImplicitAriaRoles(as in the earlier #1376) isn't enough —makeRoleSelectorfilters the candidate elements first, so<search>never reaches the role check. The added integration test (getByRole('search')) covers that path; there's also a unit test forgetImplicitAriaRoles.Full suite green (668 tests). #1376's contentious
inertchange is intentionally left out — this is only the uncontroversial<search>support.