ranbuch / accessibility

add accessibility to your website
MIT License
293 stars 40 forks source link

Negative line height breaks page when loading from state #80

Open calcifer63 opened 1 week ago

calcifer63 commented 1 week ago

I found this bug and I think I know how to solve it aswell.

How to reproduce

I would recommend you reproduce this error on Firefox as it is easier to fix but I have also reproduced it on Chrome:

  1. Go to the demo page of this project.
  2. Reset your accessibility options and decrease the line height by 1 to make it negative.
  3. Refresh the page.

The page should now be in an infinite loading state. Using firefox you can simply wait until the browser gives you a prompt to kill the running process and delete your local storage via the dev tools. On Chrome the easiest way I think is to disable JS for the site and clear the local storage once you can actually load the page.

How to fix

I can't really test it myself and provide a pull request sadly (sorry about that) but I think the fix should be straight forward:

In this line of code I think it should be this: while (lineHeight++) { like it is for the other options (like textSpace above).

Sorry for not simply providing a pull request and I hope this issue is understandable and you can work with the information given. I you have any further questions or problems reproducing let me know.

ranbuch commented 4 days ago

@calcifer63 Thank you for letting me know. The bug was fixed.