Search groups controls for searching or filtering content. It can make the site's search area easier to identify without inventing a custom ARIA role.
What You Need to Know
The search element is a semantic container, not a search engine. The form still needs an action, input name, and server-side behavior to return real results.
Search identifies a search/filter area; it does not run a search engine by itself.
Example: See It in Action
Here is a simple example to experiment with. Type it, save the file, and check what the browser displays.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<search>
<form action="/find" method="get">
<label for="search-query">Search lessons</label>
<input id="search-query" name="q" type="search">
<button type="submit">Search</button>
</form>
</search>
Let’s Understand the Example
- Search marks an area used for searching or filtering, making its purpose clearer to assistive technology.
- Form groups controls that send named values to an endpoint when submitted.
- Label tells people what a control is for. For connects the label to the control with the matching id.
- Action names the destination where the browser sends a form submission. A real server handler must exist there.
- Method controls how a form submits; GET makes values part of the URL, while POST sends them in the request body.
- For links a label to the input whose id matches, so clicking the label can focus the control.
The browser can submit values with keys such as q. A control without a name normally contributes no entry. Whether the submission produces a result depends on the action URL and the server behind it.
What Should You See?
The page should include “Search lessons”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.
Try removing one piece of markup in a scratch copy, refresh the page, and compare the behavior. This is often the fastest way to understand what that piece contributes.
Try It Yourself
- Add a category filter and describe the query values the form would send.
- Save your changes, open or refresh the page, and compare the result with the original example.
- Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.
Common Beginner Mistakes
- Thinking that putting an input inside search automatically implements searching.
- Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.
Key Takeaways
- Search groups controls for searching or filtering content.
- Search marks an area used for searching or filtering, making its purpose clearer to assistive technology.
- Search identifies a search/filter area; it does not run a search engine by itself.