inkle / inkle/inky

scrollDown malfunctions if it needs to scroll up instead

Open
#506 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

The scrollDown method in main.js is supposed to scroll to the new text after making a choice. This normally does require, well, scrolling down. But it can sometimes require scrolling up instead, if there are enough choices that the top of the first choice is above the browser viewport. When this happens it tries to scroll upward forever, preventing the user from accessing anything lower on the page.

To reproduce, have a long enough list of choices and a high enough browser zoom that the top of the choice list is above the viewport. Click any choice. The scroll bar will become stuck at the top of the page else, preventing the user from seeing anything else.

The broken line is:
```
var duration = 300 + 300*dist/100;
```
This results in a negative duration when `dist` is negative, which means the animation never ends. It should instead use `Math.abs(dist)`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.