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 4 commits into
base: master
Choose a base branch
from

Conversation

marcustyphoon
Copy link
Collaborator

@marcustyphoon marcustyphoon commented Jul 16, 2024

Description

When a post is hidden by any of our post hiding features, searching the page for a term that is in that post will result in hits if and only if the post in question is far off the screen, due to the way tumblr's virtual scroller component works.

This adjusts the CSS that we use to create hidden posts so that post elements will have both their element children and text node children removed from the DOM, preventing them from being searched. It uses the css content property to replace post element contents (whatever they are) with a no-op "image", which is supported as of Firefox 113. We cannot simply display: none the target post elements themselves, as we need them to continue to be rendered and have bounding boxes so that j/k scrolling code continues to find them.

Notably, this also does the same thing as #593, i.e. presumably making Tumblr's observer elements (correctly) think the user is not viewing the post in question. As mentioned in that PR, I don't know if there are actual consequences of this.

(Height is set to 0 because apparently in Chromium unset-height gradients are half as tall as they are wide. No idea why this is; a linear gradient should have no intrinsic height. This isn't necessary in Firefox. But sure, I guess, why not.)

Resolves #1543.

Testing steps

  • Confirm that each feature still hides posts correctly and shows posts again when it's toggled off, including when scrolled far down the dashboard, with endless scrolling enabled.
  • Confirm that each feature still hides posts correctly and shows posts again when it's toggled off, including when scrolled far down the dashboard, with endless scrolling disabled.
  • Copy some text from a post that will be hidden with Show Originals. Hide the post with Show Originals. Scroll far away from it and search the page for the post text. Confirm that there are no results.
  • Enable Show Originals and Seen Posts. Scroll slowly down the dashboard to mark only original posts as seen. Navigate away from and back to the dashboard, dimming seen posts. Disable Show Originals and confirm that the non-original posts that are now visible have not been dimmed, because Seen Posts correctly determined that the user had not seen them.
  • Confirm that hiding posts on a masonry view works (e.g. by using postblock on a masonry view search page).

Tested in Firefox 121.
Show Originals smoke tested in Chrome 126 and desktop Safari 17.4.1

@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