Menu

Collapsed content shouldn't vanish from find-in-page. hidden=\"until-found\" stops that
📰

Collapsed content shouldn't vanish from find-in-page. hidden=\"until-found\" stops that

DEV Community: html·Leo·about 18 hours ago
#X8pF9tEL
#devto2#devto#dev#hidden#found
Long article (924 words) — no AI summary yet.
Reading 0:00
15s threshold

A reader lands on a news story cut in half by a "Continue reading" button. They want one detail, the departure time, so they press Ctrl+F and type it. Zero results. The text is right there on the page.

Roy Keur opens day 4 of the HTMHell Advent Calendar with exactly that pattern, and it fails more than the find bar. A link to a page anchor inside the collapsed part goes nowhere. A text fragment URL like #:~:text=departure%20time highlights nothing. For anyone who gets around long pages by searching or following deep links, the collapsed part of your page doesn't exist.

What display: none takes away

Here is the simplified markup Keur uses for that "Continue reading" pattern:

<button type = "button" aria-expanded = "false" > Continue reading this article </button> <p data-readmore-hidden = "1" style = "display: none;" > You can either use a catamaran, which takes one hour and fifteen minutes with departure time at 11:30, or take the slower cruise ship which takes two hours and 30 minutes, with departure…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.