Skip to content

When page was resized (the height has become smaller, eg: lazy load items or lanscape mod on mobile phone), will scroll hundreds of times before timeout #16

Open
@mixalbl4-127

Description

@mixalbl4-127

I had problem when page with button "more" increased height till 5000 - 10 000 pixed, you clicked to some Item at bottom (scrollTop === 10 000), and you press "back", height of page becomes original (~1 000px) without new items (because button more was not clicked again). In this case, react scroll manager going to scoll hundreds of times (on any observer event) but unsuccessful, because it scroll to 1 000px and 10 000px is unreachable. At this time user try to scroll UP, he will be scrolled to bottom now, till timeout. A very nasty bug.

In this regard, I changed the logic of the library's behavior. Now, before attempting to scroll the page, we calculate whether this attempt will be successful, if it cannot succeed - it don't even try to do this.

But now I saw situations, when page has a little bit dynamic height (+- 5px because of example: :hover { border: 2px solid red; }), for this case Ive added new prop blockSizeTolerance`

I've removed Skipping save due to deferred scroll of ${scrollKey} bacause no need it anymore, _savePosition will not have fake calls from attemptScroll because now we execute window.scrollTo only once, when 100% have reachable scroll position.

Pull: #15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions