openaustralia / theyvoteforyou

Making parliamentary voting information accessible, understandable, and easy to use so that you can hold your elected representatives to account.
https://theyvoteforyou.org.au/
Other
135 stars 30 forks source link

Card titles don't always shrink to fit in the card. #1388

Closed MutazAshhab closed 2 years ago

MutazAshhab commented 2 years ago

I visited https://theyvoteforyou.org.au/policies/86?card=true earlier and saw that the card title had not been adjusted to fit the card.

Here is a screenshot.

image

This is hard to reproduce since it is caused by the event listener firing off before the html is actually rendered.

I did some digging to find out that DOMContentLoaded from the MDN web docs:

The DOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.

And the load event also from MDN web docs:

The load event is fired when the whole page has loaded, including all dependent resources such as stylesheets and images. This is in contrast to DOMContentLoaded, which is fired as soon as the page DOM has been loaded, without waiting for resources to finish loading.

A fix to this issue is changing the event listener to load rather than DOMContentLoaded

MutazAshhab commented 2 years ago

Closing is the PR has been merged