Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      The Psychology Of Color In UX Design And Digital Products

      August 15, 2025

      This week in AI dev tools: Claude Sonnet 4’s larger context window, ChatGPT updates, and more (August 15, 2025)

      August 15, 2025

      Sentry launches MCP monitoring tool

      August 14, 2025

      10 Benefits of Hiring a React.js Development Company (2025–2026 Edition)

      August 13, 2025

      I flew Insta360’s new ‘Antigravity’ drone around Los Angeles, and it was impossible to miss a shot

      August 15, 2025

      The $100 open-ear headphones that made me forget about my Shokz

      August 15, 2025

      5 quick and simple ways to greatly improve the quality of your headphones

      August 15, 2025

      Installing a UPS battery backup saved my work PC – here’s the full story

      August 15, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Maintaining Data Consistency with Laravel Database Transactions

      August 16, 2025
      Recent

      Maintaining Data Consistency with Laravel Database Transactions

      August 16, 2025

      Building a Multi-Step Form With Laravel, Livewire, and MongoDB

      August 16, 2025

      Inertia Releases a New Form Component

      August 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Google’s Gemini AI had a full-on meltdown while coding — calling itself a fool, a disgrace, and begging for freedom from its own loop

      August 15, 2025
      Recent

      Google’s Gemini AI had a full-on meltdown while coding — calling itself a fool, a disgrace, and begging for freedom from its own loop

      August 15, 2025

      Take-Two hints at $100 price tag for Grand Theft Auto VI — will it deliver on value?

      August 15, 2025

      ChatGPT Go offers GPT-5, image creation, and longer memory — all for $5 (if you’re lucky enough to live where it’s available)

      August 15, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»Covering hidden=until-found

    Covering hidden=until-found

    August 15, 2025

    Filing this in the “Missed First Time Around” category. It popped up in the Firefox 139 release notes and I was, like, ooo neat. Then I saw it’s been in Chrome since at least 2022. And as I wrote this, it landed in Safari Technology Preview 125. So there you have it.

    Turns out there are a few good posts and tutorials about hidden=until-found floating out there, so I thought I’d jot down a few key takeaways for later reference.

    It makes hidden content “findable”

    Short story: Slapping hidden=until-found on an element in HTML enables any hidden content within the element to be findable in the browser with in-page search.

    <div hidden="until-found">
      <!-- hidden content -->
    </div>

    You’ll see, or more accurately not see, that the content is hidden with that in place:

    CodePen Embed Fallback

    It’s content-visibility: hidden under the hood

    The browser takes that as a hint to hide the content and does so by implicitly setting content-visibility: hidden on the element in the user agent styles.

    Inspecting an element with the attribute in place in Chrome DevTools.

    If we do a Ctrl+F on the keyboard to activate in-page search and enter a query, then a match reveals the content, highlighting said matched query.

    Showing a highlighted term on the page for a matched search query.

    Why we need this

    That’s what I was asking myself when I started digging into this a little deeper. The most prominent example of it being used is from the Chrome for Developers docs as a faux-accordion. You know, a series of panels that open and close on click.

    CodePen Embed Fallback

    But isn’t that a solved deal now that we have the <details> element at the ready? May as well use a semantic disclosure widget to, you know, disclose content. Indeed, browsers also set content-visibility: hidden on the ::details-content portion of the element that holds the content.

    Inspecting the details element's Shadow DOM in Chrome DevTools.

    I’m pretty sure <details> was not as widely supported in 2022 as it is today. It’s actually part of Interop 2025 and notice that one of the functionalities mentioned is the capability for in-page search. Chrome already supports it. Firefox recently shipped it (ostensibly as part of the hidden=until-found release). And Safari will presumably get there with Interop 2025. The example from the Chrome for Developers post demonstrates an approach for working around a not-fully-supported <details> element and now we have it.

    So, why hidden=until-closed?

    I don’t know. I’m sure there’s a good use case for hiding content accessibly in some fashion while making it searchable. I just can’t think of it off the top of my head. I mean, we have popover as well, but that takes a different approach with display: none which completely removes the content from in-page search.

    Showing the user agent styles for a popover element in Chrome DevTools.

    Browser support and polyfill

    We’ve already established that Chrome and Firefox are on board. Safari is the bigger holdout, but knowing that making the hidden content in <details> findable is part of Interop 2025 (and Firefox’s corresponding support for it as part of that effort) makes me think it’s around the corner. (Turns out that hunch was correct because it landed in Safari Technology Preview 125 after writing this.)

    In the meantime, though, is it worth using hidden=until-found? Because if we’re aiming for a consistent cross-browser experience, we’d need to do some sort of swap between content-visibility: hidden to hide the content and content-visible: auto to reveal it.

    Nathan Knowler expertly explains the conundrum this creates. We can’t set content-visibility: hidden on something without also removing it from in-page search. The hidden=until-found attribute works exactly like content-visibility: hidden but maintains that in-page search still works. In other words, we can’t polyfill the feature with content-visibility.

    Thanks, Nathan, for going down the massive rabbit hole and finding a solution that leverages the Shadow DOM to look for the HTML attribute, check support, and revert its properties when needed to accessibly hide the content visually without fully nuking it from being found.

    Styling

    Seems like there isn’t much to say about styling something that ain’t visible, but notice that the in-page search feature highlights content that matches the search query.

    Highlighting a single matched search term.

    Looks like we may get a new ::search-text pseudo that allows us to select the matched query and style the highlight color in the CSS Pseudo-Elements Module Level 4 specification, which is currently in Editor’s Draft status at the time I’m writing this.

    What about multiple matches? The current selection gets a different highlight from subsequent matches.

    Highlighting two matches for a search query. The first highlight is orange and the second highlight is yellow.

    We’ll presumably, according to the spec, be able to combine ::search-text with the :current pseudo-class to target the current match: ::search-text:current.

    If you’re thinking we might get to mix-and-match ::search-text with the corresponding :past and :future pseudo-classes, I’m afraid the spec says nay. But it does not shut the door on it completely:

    The :past and :future pseudo-classes are reserved for analogous use in the future. Any unsupported combination of these pseudo-classes with ::search-text must be treated as invalid.

    Anything else?

    Not really, but I do like the note at the end of Christian Shaefer’s “Rethinking Find-in-Page Accessibility” post that says consideration needs to go into what happens after a search query matches content on the page. Currently, the content remains visible even after in-page search is closed or canceled. Perhaps we’ll need some other HTML hint for that.

    Links

    A dump of things I found and used while researching this:

    • “Making collapsed content accessible with hidden=until-found” (Joey Arhar)
    • “Polyfilling hidden until-found” (Nathan Knowler)
    • “Hidden until found” (James McGrath)
    • “The hidden=until-found HTML attribute and the beforematch event” (WICG explainer)
    • “Announcing Interop 2025” (WebKit Blog)
    • Bugzilla Ticket #1761043
    • MDN content update (GitHub)
    • ::search-text (CSS Pseudo-Elements Module Level 4)

    Covering hidden=until-found originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleDistribution Release: EasyOS 7.0
    Next Article Designer Spotlight: Clarisse Michard

    Related Posts

    News & Updates

    I flew Insta360’s new ‘Antigravity’ drone around Los Angeles, and it was impossible to miss a shot

    August 15, 2025
    News & Updates

    The $100 open-ear headphones that made me forget about my Shokz

    August 15, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Microsoft Waves Off Fee for Indie Devs, Rolls Out Major Store Upgrades – Check Details Here

    Operating Systems

    From Accountant to Data Engineer with Alyson La [Podcast #168]

    Development

    Mozilla rolls out Firefox 141.0.3 update to fix two specific bugs

    Operating Systems

    KNOPPIX is a bootable Live system

    Linux

    Highlights

    News & Updates

    CalDigit made the best Thunderbolt 5 dock for Windows power users — but can you afford it?

    June 26, 2025

    I’ve been using CalDigit’s TS5 Plus Thunderbolt 5 docking station for a couple of weeks,…

    The 10 Best Managed WordPress Hosting Providers in 2025

    June 18, 2025

    What I Wish Someone Told Me When I Was Getting Into ARIA

    June 17, 2025

    What Are Enterprises’ Top AI Investments in 2025

    August 6, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.