Skip to content

Add height and width attributes to ballot cover images#457

Merged
mjmusante merged 1 commit into
iftechfoundation:mainfrom
dfabulich:ballot-image-dimensions
Sep 1, 2025
Merged

Add height and width attributes to ballot cover images#457
mjmusante merged 1 commit into
iftechfoundation:mainfrom
dfabulich:ballot-image-dimensions

Conversation

@dfabulich
Copy link
Copy Markdown
Contributor

This prevents layout shift on the ballot page.

Fixes #453

This prevents layout shift on the ballot page.

Fixes iftechfoundation#453
@dfabulich
Copy link
Copy Markdown
Contributor Author

I'm not 100% sure this is the "best" way to do it, but I'm trying to fix #453 in a hurry, and this certainly appears to work on my dev machine.

In particular, this code will run Imager to get the height/width of all cover art every time the page loads. That seems inefficient. But I bet it's manageable, and we can improve performance with a cache in a subsequent PR if we find that the performance impact is too severe.

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 62.02% (+0.07%) from 61.946%
when pulling 9af07c0 on dfabulich:ballot-image-dimensions
into 3550103 on iftechfoundation:main.

@mjmusante mjmusante merged commit eaa64ef into iftechfoundation:main Sep 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants