From 33cb1b7cf1aa93e2096fc2b98475b849a63fd1af Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 3 Jun 2021 22:09:59 -0400 Subject: [PATCH] FIX: Ensure images in polls don't cause abrupt scrolling (#13272) In some very rare cases, poll options can end up with images that have no dimensions, in which case, navigating to replies in that post stream might result in unexpected scrolling (as the browser loads the images and adjusts its layout). This ensures that if width/height attributes are missing from an image, the image is forced to display within a 200 by 200 pixels space. Co-authored-by: David Taylor --- plugins/poll/assets/stylesheets/common/poll.scss | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/poll/assets/stylesheets/common/poll.scss b/plugins/poll/assets/stylesheets/common/poll.scss index e0126524f20..4669cd293a6 100644 --- a/plugins/poll/assets/stylesheets/common/poll.scss +++ b/plugins/poll/assets/stylesheets/common/poll.scss @@ -25,9 +25,18 @@ div.poll { } img { + // TODO: remove once disable_image_size_calculations is removed // needed to override internal styles in image-sizing hack max-width: 100% !important; height: auto; + // Hacky way to stop images without width/height + // from causing abrupt unintended scrolling + &:not([width]), + &:not([height]) { + width: 200px !important; + height: 200px !important; + object-fit: contain; + } } .poll-info {