Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude hidden posts from page search #1544

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

marcustyphoon
Copy link
Collaborator

@marcustyphoon marcustyphoon commented Jul 16, 2024

Description

This... makes me uncomfortable.

It uses the css content property to replace the contents of cell elements we want to hide with a no-op (which must be an image, as it's the only supported value for this value on non-pseudo elements at the moment). This removes the need to target the child element(s) with display: none, and thus works correctly when the content we want to hide is or contains a text node which cannot be targeted by CSS. (In the case of the linked issue, this is the text that makes offscreen posts searchable via control-F.)

We cannot simply display: none the target elements themselves, as we need them to continue to be rendered and have bounding boxes so that observers targeting them continue to work.

Not entirely sure where the height comes from if you remove height: 0; a linear gradient has no intrinsic height. I guess there's a default height?

Resolves #1543.

Using a gradient as an element content replacement supposedly requires Firefox 113, per MDN/caniuse. Show Originals smoke tested in Firefox 126, Chrome 126, and desktop Safari 17.4.1 (there's some jank when switching Show Originals on or off and then scrolling into a previously loaded area, but I believe that's the case with or without this PR and is due to Virtual Scroller Things™).

Testing steps

@marcustyphoon marcustyphoon changed the title Improve post hiding CSS Prevent page search finding hidden posts Aug 18, 2024
@marcustyphoon marcustyphoon marked this pull request as ready for review August 18, 2024 01:27
@marcustyphoon marcustyphoon changed the title Prevent page search finding hidden posts Exclude hidden posts from page search Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hidden posts behave poorly with control-F
1 participant