Thanks Benjamin. Thanks to you I have finally found the problem. After I uploaded an example to post I tried it on a different computer/ browser and I could not replicate the issue.
Apparently it is a bug in my (old) version of Firefox. https://bugzilla.mozilla.org/show_bug.cgi?id=212362