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

AccessKit Disable GIFs: Use content replacement #1708

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

marcustyphoon
Copy link
Collaborator

@marcustyphoon marcustyphoon commented Jan 22, 2025

Description

As a proof of concept, this modifies Disable GIFs by entirely replacing the technique of inserting canvas elements into the DOM with a new technique: overriding the content of non-hovered image elements using the css content property. This also contains various commits from other Disable GIFs PRs.

Because this version of Disable GIFs is implemented entirely in CSS—besides the labels; maybe they could be pseudos, but you can't pseudo an <img> so probably not—this removes basically all restrictions on what GIF elements we can hit. DOM structure and layout don't matter. Animated blog headers (including in blog cards) are now fair game, as are images in link cards, the thumbnail images in the search dropdown and the header above the tumblr labs settings.

The drawbacks of doing this are mainly that its pausing-images-quickly performance can be pretty bad, e.g. when navigating to the tagged page for "gif" (it's a lot of blob URLs to create at once) and that I've observed some weird flickering when moving the cursor off of an affected GIF in some cases. I would not actually merge this as-is, though; we have a much better method for pausing GIFs in posts, which is to use or create a duplicate of Tumblr's native poster element. That has far better performance than our current method and fixes the on-hover flicker here. The technique in this PR is best for niche GIFs throughout the UI that don't have posters (setting content if they are true image elements and overriding background-image when they are not), and these are generally few in number and/or can't be paused by any other method anyway.

Testing steps

@marcustyphoon marcustyphoon force-pushed the disable-gifs-content-replacement branch 5 times, most recently from c332219 to eb4047e Compare January 23, 2025 01:03
@marcustyphoon marcustyphoon force-pushed the disable-gifs-content-replacement branch 5 times, most recently from c1fa486 to e392cf7 Compare January 23, 2025 14:18
@marcustyphoon marcustyphoon force-pushed the disable-gifs-content-replacement branch from 90c3c24 to 9cd913e Compare February 8, 2025 10:42
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.

1 participant