What is Hidden Until Found?
Modern web development demands efficient ways to manage content visibility without sacrificing performance or accessibility. The hidden=until-found HTML attribute represents a significant advancement in how browsers handle hidden content, enabling developers to keep substantial portions of their pages hidden while maintaining searchability and smooth user experiences.
Unlike older methods that completely removed elements from the document flow, this attribute allows browsers to render minimal layout information while keeping content discoverable through find-in-page functionality and fragment navigation.
The emergence of hidden=until-found addresses a common challenge in web applications: how to collapse large sections of content--such as expanded details, detailed specifications, or lengthy FAQs--without incurring the performance costs of rendering hidden content or sacrificing the ability for users to discover that content through search. This approach proves particularly valuable for content-heavy websites, documentation platforms, and applications with extensive help sections or product details.
As part of our comprehensive approach to modern web development practices, understanding these browser-native optimizations helps us build faster, more accessible experiences for all users.
Performance Optimization
Browser skips layout and rendering calculations for hidden content using content-visibility: hidden, improving page load times.
Search Discoverability
Content remains accessible to browser find-in-page search and fragment navigation, unlike display: none elements.
Smooth Reveal Experience
Elements maintain layout space while hidden, enabling smooth transitions when content becomes visible.
Beforematch Event Hook
Fire custom logic before content reveals, enabling animations, data fetching, or state updates.
How Hidden Until Found Works
The Beforematch Event
The beforematch event is the cornerstone of the hidden-until-found functionality. When find-in-page search or fragment navigation targets content within a hidden-until-found element, the browser fires this event before removing the hidden attribute.
This event enables developers to prepare content before reveal, trigger entrance animations, update related UI state, or perform any necessary setup. The event follows a specific sequence: first, the browser detects that the search term or fragment identifier exists within a hidden-until-found element. Then, before revealing the element, the browser creates and dispatches the beforematch event. Finally, the browser removes the hidden attribute and scrolls the page to display the content.
Browser Behavior and Layout Considerations
When an element carries hidden="until-found", the browser applies content-visibility: hidden internally, which skips layout and painting for the element's contents while maintaining the element's box in the layout tree. Unlike elements hidden with display: none, hidden-until-found elements maintain their space in the document flow--their margins, borders, and background render normally.
The reveal mechanism activates through two primary pathways: the browser's find-in-page functionality (Ctrl+F or Cmd+F) searches across all text including hidden content, and fragment navigation where a URL includes an anchor identifier targets elements regardless of their hidden state.
For developers exploring related CSS optimization techniques, our guide on next-generation CSS container queries covers complementary approaches to content rendering and visibility management.
1const hiddenSection = document.getElementById('detailed-specs');2 3hiddenSection.addEventListener('beforematch', () => {4 // Prepare content before reveal5 hiddenSection.classList.add('revealing');6 console.log('Content is about to be revealed');7 8 // Update ARIA states for accessibility9 hiddenSection.closest('.accordion')10 ?.querySelector('.header')11 .setAttribute('aria-expanded', 'true');12});Browser Support and Compatibility
Browser support for hidden="until-found" has expanded significantly across modern browsers, making it a viable option for production use:
- Chrome/Edge: Supported since version 105
- Firefox: Supported since version 144 (October 2025)
- Safari: Supported since version 18
According to the MDN Web Docs documentation, the hidden attribute's until-found state provides an elegant solution by leveraging browser-native optimizations while maintaining discoverability.
The convergence of support across major browsers reflects the feature's maturity. For most projects targeting modern browsers, hidden="until-found" can be used without significant compatibility concerns. However, implementing appropriate fallbacks ensures that all users receive functional experiences.
The Chrome for Developers documentation provides detailed implementation patterns and accessibility considerations for this feature.
1// Feature detection for hidden="until-found" support2const supportsHiddenUntilFound = CSS.supports('content-visibility', 'hidden');3 4if (supportsHiddenUntilFound) {5 // Apply hidden-until-found for supporting browsers6 document.querySelectorAll('.collapsible').forEach(element => {7 element.setAttribute('hidden', 'until-found');8 });9} else {10 // Fallback for older browsers11 document.querySelectorAll('.collapsible').forEach(element => {12 element.classList.add('legacy-hidden');13 });14}Performance Benefits
The performance implications of hidden="until-found" represent one of its most compelling advantages for modern web applications. By leveraging the browser's content-visibility optimization, this attribute enables significant rendering improvements for pages with substantial hidden content.
When browsers implement hidden-until-found using content-visibility: hidden, they skip several expensive rendering operations for the hidden content. The browser doesn't calculate layout for the element's contents, doesn't paint those contents, and doesn't respond to style recalculations for the hidden subtree. These optimizations compound for pages with extensive hidden sections.
Measuring Performance Impact
For pages with multiple accordion sections containing detailed specifications or FAQs, applying hidden="until-found" reduces initial render time and improves scrolling performance. The browser focuses its rendering resources on visible content, delivering faster initial paint. This improvement proves especially valuable on mobile devices where rendering capacity is more constrained.
Core Web Vitals metrics often improve when applying this technique to large hidden sections. Largest Contentful Paint (LCP) benefits from reduced initial rendering work, while Cumulative Layout Shift (CLS) improves because hidden-until-found elements maintain their layout space even when hidden.
These performance optimizations align with our focus on technical SEO and fast, accessible web experiences. For teams evaluating CSS frameworks and their impact on performance, our CSS framework comparison provides additional insights into optimization strategies.
Accordion Interfaces
Hide detailed content behind collapsible headers while maintaining searchability for users who prefer Ctrl+F.
Documentation & Help Centers
Keep supplementary material hidden but searchable, helping users find specific answers quickly.
Long-Form Content
Expandable sections for detailed explanations, related articles, or supplementary data without cluttering reading experience.
Implementation Best Practices
Common Pitfalls to Avoid
-
Display Property Issues: Never apply
display: noneto hidden-until-found elements--useblock,flex, orgridinstead. Elements withdisplay: nonecannot be revealed through find-in-page or fragment navigation. -
Nesting Problems: Ensure the hidden-until-found attribute is on the correct containing element for your reveal targets. When a hidden-until-found element contains another element with an ID that might be targeted by fragment navigation, the containing element itself must carry the attribute.
-
Dynamic Content: Apply the hidden attribute immediately when creating dynamic hidden content. For content loaded asynchronously, ensure the hidden attribute is applied before insertion into the DOM.
CSS Requirements
.detailed-content {
display: block;
contain: layout style;
}
.detailed-content[hidden="until-found"] {
content-visibility: hidden;
}
The CSS contain property helps the browser optimize rendering by limiting the scope of layout and style recalculations. Combined with the content-visibility: hidden applied by the hidden-until-found state, this creates an efficient hidden content pattern.
For developers looking to expand their CSS toolkit, our guide on CSS custom property toggle tricks demonstrates additional techniques for managing dynamic content visibility with modern CSS.
Accessibility Considerations
Conclusion
The hidden=until-found attribute provides a powerful mechanism for hiding content while maintaining discoverability through search and navigation. By leveraging browser-native optimizations through content-visibility: hidden and the event-driven reveal mechanism, developers can create interfaces that remain performant and accessible while supporting diverse user navigation patterns.
Implementing this attribute requires attention to proper CSS display values, coordination with JavaScript interactivity, and consideration of accessibility requirements. When applied appropriately--particularly to supplementary content, accordion sections, and documentation-style pages--it significantly improves both performance and user experience.
As browser support continues to expand, hidden="until-found" will become a standard tool in the modern web developer's toolkit. Its combination of performance benefits, accessibility considerations, and user experience improvements makes it an essential technique for building efficient, discoverable web content.
Looking to optimize your website with modern web techniques? Our team specializes in building high-performance websites using the latest web standards and front-end technologies. Contact us to discuss how we can help improve your site's performance and accessibility.
Sources
- MDN Web Docs - HTML hidden global attribute - Comprehensive official documentation on the hidden attribute including the until-found state
- Chrome for Developers - Making collapsed content accessible with hidden=until-found - Chrome-specific guidance on implementing hidden=until-found
- Chrome for Developers - View Transitions 2025 - Browser support information and API developments