mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 08:36:05 +08:00
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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user