curiousdannii / parchment

The Interactive Fiction web app
https://iplayif.com
MIT License
421 stars 60 forks source link

Fix auto scrolling in Chrome #67

Closed MarcCote closed 4 years ago

MarcCote commented 4 years ago

In recent Chrome versions, taking the offset/position of a 0-width and 0-height span element always returns 0. This PR changes the style of the marker lastinput so it has a nonzero offset/position.

This addresses https://github.com/curiousdannii/parchment/issues/50#issuecomment-533946039.

NB: for convenience, I also included in this PR a commit with a recent build of parchment.

Quuxplusone commented 4 years ago

I tried to apply this patch to what I've got over at https://github.com/Quuxplusone/Advent/tree/gh-pages , but it seems to make my problems on Chrome even worse! Bear in mind I'm using a version of Parchment (and the corresponding Inform7-generated index.html) from 2016 and I'm probably doing something wrong. However:

Pre-patch (https://github.com/Quuxplusone/Advent/commit/36e2e28965aafffc1c245f8f95b3c0eb58d75849), the symptom on Chrome is that the gameport doesn't autoscroll; it gets a scroll bar and you have to manually scroll down after every input.

Post-patch (https://github.com/Quuxplusone/Advent/commit/9e081bf9d49b2ae764673688920b262d915440a9), the symptom on both Chrome and Firefox seemed to be that the gameport doesn't autoscroll and doesn't get a scrollbar! It just overflows off the bottom of the page and there's no way to see what's going on down there because you can't scroll. But then I backed my change out and reapplied it and refreshed the page, and then I couldn't reproduce that new symptom; it just went back to the old pre-patch symptom.

But I admit that my CSS is all screwed up. Maybe I'm doing something else wrong? Could I ask you to clone my repo and see if you can get it to work in Chrome?

MarcCote commented 4 years ago

I think you also need this change: https://github.com/curiousdannii/parchment/pull/61/files#diff-e4a4476dbe1d400e7155a903822b966eL456

Quuxplusone commented 4 years ago

Awesome! I confirm that scrolling in Chrome (both on my MacBook and on my Android phone) now look much better, after applying both of those patches.

curiousdannii commented 4 years ago

Thanks!