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 <david@taylorhq.com>
This commit is contained in:
Penar Musaraj 2021-06-03 22:09:59 -04:00 committed by GitHub
parent 3c1f4d5771
commit 33cb1b7cf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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 {