curiousdannii / parchment

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

Update parchment.debug.js #52

Closed cHameleonRu closed 6 years ago

cHameleonRu commented 6 years ago

Auto-scrolling for Chrome (fix issue https://github.com/curiousdannii/parchment/issues/50)

yandexx commented 6 years ago

I'll add that I've tested this fix with Firefox, Chrome and Edge on Windows 10, plus Chrome and Firefox on Android, and auto-scrolling works fine on all of these.

curiousdannii commented 6 years ago

Thanks for finding a solution!

But... I don't think this preserves the behaviour as it was meant to be: to scroll down but ensure the beginning of this turn's input is on screen. That said, I'm still open to merging this, however you'll need to edit src/structio/input.js instead, and rather than intercepting the call to scroll(), please put the test inside that function.

Does anyone know why the current code doesn't work?

cHameleonRu commented 6 years ago

line: 163 "parchment/src/structio/input.js"

self.scrollParent = /webkit/i.test( navigator.userAgent ) ? $body : $( 'html' );

If "self.scroolParent = $body", then "this.scrollParent.scrollTop()" always is 0. For Chrome need "$( 'html' )", but Microsoft Edge need "$body".