the details element and in-page search

An important factor in terms of UX and accessibility for deciding whether the <details> element is the right solution for a problem is the find-in-page behaviour.In Chromium-based browsers, the details element aut…


This content originally appeared on Manuel Matuzović - Blog and was authored by Manuel Matuzović

An important factor in terms of UX and accessibility for deciding whether the <details> element is the right solution for a problem is the find-in-page behaviour.

In Chromium-based browsers, the details element automatically opens when it contains a string the user searches for.
If Safari and Firefox, it has to be opened for the find-in-page feature to find the string.

Comparison of Chrome (left) and Firefox. Search for the term 'cook' shows two results in Chrome, details element opened by the browser. Firefox only shows one result, details element closed.

You can try it yourself in this demo.

I often hear the question, “Can I use the details element for page navigation?”. My answer is always “No” for two main reasons:

  1. You probably don’t want your navigation to open randomly only because a user searched for a term on the page.
  2. There are still a lot of browser inconsistencies, and you want such an important part as the navigation for your site to work consistently and reliably.

You can find more examples and details in Adrian Roselli's “Details / Summary Are Not [insert control here]”.

My blog doesn't support comments yet, but you can reply via blog@matuzo.at.


This content originally appeared on Manuel Matuzović - Blog and was authored by Manuel Matuzović


Print Share Comment Cite Upload Translate Updates
APA

Manuel Matuzović | Sciencx (2023-06-30T00:00:00+00:00) the details element and in-page search. Retrieved from https://www.scien.cx/2023/06/30/the-details-element-and-in-page-search/

MLA
" » the details element and in-page search." Manuel Matuzović | Sciencx - Friday June 30, 2023, https://www.scien.cx/2023/06/30/the-details-element-and-in-page-search/
HARVARD
Manuel Matuzović | Sciencx Friday June 30, 2023 » the details element and in-page search., viewed ,<https://www.scien.cx/2023/06/30/the-details-element-and-in-page-search/>
VANCOUVER
Manuel Matuzović | Sciencx - » the details element and in-page search. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/06/30/the-details-element-and-in-page-search/
CHICAGO
" » the details element and in-page search." Manuel Matuzović | Sciencx - Accessed . https://www.scien.cx/2023/06/30/the-details-element-and-in-page-search/
IEEE
" » the details element and in-page search." Manuel Matuzović | Sciencx [Online]. Available: https://www.scien.cx/2023/06/30/the-details-element-and-in-page-search/. [Accessed: ]
rf:citation
» the details element and in-page search | Manuel Matuzović | Sciencx | https://www.scien.cx/2023/06/30/the-details-element-and-in-page-search/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.