logoalt Hacker News

jdlshoretoday at 3:16 PM7 repliesview on HN

The “hidden until found” feature surprised me. What’s the use case for something like that?


Replies

dofmtoday at 3:31 PM

Looks like it's basically like a one way show-hidden mechanism, but the browser's built-in search will pop it open on matches.

So you could use it for additional notes, things like "view pricing terms" or "show exclusions" on product listings — stuff people need to read only when they need to read it — without it being hidden from them if they search for it.

dspilletttoday at 4:48 PM

It won't be an intended use case, but it might be a convenient place to put poisoned content for the “benefit” of scrapers…

Though humans will accidentally find it too, so using a details tag with appropriate summary as a warning would be more friendly than just hidden content. It'll still get opened, but the user at least has a way of closing it again afterwards.

Also before using it I'd want to check what old UAs including accessibility tools tend to do when they hit a value that they don't recognise for the hidden="" attribute - would what they don't recognise as a valid value result in defaulting to the content being hidden or visible/read/other?

wvbdmptoday at 3:55 PM

Pretty cool! I’ve been using <details> for this. One example would be a collapsible tree hierarchy of our organization that you can CTRL+F and still find collapsed teams and people. Or an accordion, or anything collapsible, really.

megaman821today at 7:19 PM

I use it for tabbed content. That way search will reveal the tab and content on page search match.

pseudosavanttoday at 5:52 PM

There is a common accessibility pattern where the first tab focusable item is a "Skip to content" link in the top left corner. The link is initially hidden until you tab to it. That is the only use case I could think of when checking it out.

akerstentoday at 6:06 PM

On a big page with lots of collapsed content, I want control+f to search it and find anything in the collapsed sections without having to manually expand them all before I hit control+f

seki285today at 3:37 PM

One thing that comes to mind is JS-less image preview, clicking on an image thumbnail reveals the full preview.

show 1 reply