You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using <form role="search"> throws an error saying that we should instead use <input type="search">. However, according to MDN's ARIA: search role documentation:
The search role is a landmark role that can be added to the container element that encompasses all of the elements that combined to form the search feature of the document or application, including a descendant (<input type="search">). ... There is a input of type search), though this does not define a search landmark by itself. Using is an alternative way to define a search landmark.
and they provide an example recommending using the "search" role on a "form":
When a <form> is a search form, use the search role instead of form role.
<formid="search" role="search"><labelfor="search-input">Search this site</label><inputtype="search" id="search-input" name="search" spellcheck="false"><inputvalue="Submit" type="submit"></form>
They do recommend an alternative, using <search> as the landmark instead, which might be a better error message for this case, so the way to fix the above example might be:
<search><formid="search"><labelfor="search-input">Search this site</label><inputtype="search" id="search-input" name="search" spellcheck="false"><inputvalue="Submit" type="submit"></form></search>
Code of Conduct
I agree to follow Biome's Code of Conduct
The text was updated successfully, but these errors were encountered:
Environment information
Rule name
lint/a11y/useSemanticElements
Playground link
https://biomejs.dev/playground/?code=PABmAG8AcgBtACAAaQBkAD0AIgBzAGUAYQByAGMAaAAiACAAcgBvAGwAZQA9ACIAcwBlAGEAcgBjAGgAIgA%2BAAoAIAAgADwAbABhAGIAZQBsACAAZgBvAHIAPQAiAHMAZQBhAHIAYwBoAC0AaQBuAHAAdQB0ACIAPgBTAGUAYQByAGMAaAAgAHQAaABpAHMAIABzAGkAdABlADwALwBsAGEAYgBlAGwAPgAKACAAIAA8AGkAbgBwAHUAdAAgAHQAeQBwAGUAPQAiAHMAZQBhAHIAYwBoACIAIABpAGQAPQAiAHMAZQBhAHIAYwBoAC0AaQBuAHAAdQB0ACIAIABuAGEAbQBlAD0AIgBzAGUAYQByAGMAaAAiACAAcwBwAGUAbABsAGMAaABlAGMAawA9ACIAZgBhAGwAcwBlACIAIAAvAD4ACgAgACAAPABpAG4AcAB1AHQAIAB2AGEAbAB1AGUAPQAiAFMAdQBiAG0AaQB0ACIAIAB0AHkAcABlAD0AIgBzAHUAYgBtAGkAdAAiACAALwA%2BAAoAPAAvAGYAbwByAG0APgA%3D
Expected result
Using
<form role="search">
throws an error saying that we should instead use<input type="search">
. However, according to MDN's ARIA: search role documentation:and they provide an example recommending using the "search" role on a "form":
They do recommend an alternative, using
<search>
as the landmark instead, which might be a better error message for this case, so the way to fix the above example might be:Code of Conduct
The text was updated successfully, but these errors were encountered: