AprilSylph / XKit-Rewritten

🧰 The enhancement suite for Tumblr's new web interface
GNU General Public License v3.0
285 stars 48 forks source link

Hidden posts behave poorly with control-F #1543

Open marcustyphoon opened 1 month ago

marcustyphoon commented 1 month ago

Platform

macOS 14.4.1 arm64

Browser

Firefox 129.0b1, Chrome 126.0.6478.127

Addon version

v1.0.1

Details

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. When the browser attempts to scroll the post into view, the viewport will be left scrolled into a seemingly random location, and the search result in question will actually disappear, causing thrashing (because we do prevent control-F from finding the rendered content, but cannot do the same to the placeholder searchable text).

This would be easy to fix from the redpop side (simply wrap cachedTextContent in a div instead of directly setting the cell's content to the string, so we can hide it without hiding the cell—this would also make it easier to style in a non-silly way, I imagine), but is as far as I am aware impossible to fix from the xkit rewritten side.

I can submit this to the tumblr feedback form, though! Besides that it should probably be wontfix labelled unless someone knows of a way to cheat here (can you replace text contents with css?)

marcustyphoon commented 1 month ago

Wait WHAT.

Okay, I may have immediately disproven my own statement. Apparently this is a thing, possibly as of Firefox 113:

.element-to-hide-contents-of {
  content: linear-gradient(transparent, transparent);
  height: 0;
}

This appears to replace the contents of the element in question while leaving the contents in the DOM and, critically, still giving the element a bounding box.