XKit-Rewritten icon indicating copy to clipboard operation
XKit-Rewritten copied to clipboard

AccessKit Disable Gifs: Fix unexpected mini labels (minor)

Open marcustyphoon opened this issue 1 year ago • 0 comments

Description

A race condition can occur that causes AccessKit Disable Gifs to use miniature labels on images in a post that are the regular, full size. This happens when the post is hidden, e.g. by another XKit script, before Disable Gifs gets to process it. When the user unhides the post later (e.g. by toggling Show Originals to "all posts"), the label is visible.

This adjustment only tries to make the label miniature if gifElement.clientWidth exists and is nonzero. (It might be possible to trigger the wrong behavior in reverse, by loading a post with multiple gifs side by side in the masonry/grid view in a hidden state and then revealing it to now have labels that are too big, but I'm not sure we even have a script that hides posts in masonry and even if that does happen it's probably not noticeable.)

Testing steps

  • confirm basic Disable Gifs functionality (one could also test the actual fix, but there's only like a 50/50 chance of the behavior happening without the fix and it's some work to set up)

marcustyphoon avatar Jan 25 '24 00:01 marcustyphoon