mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(web): require user intent to cancel initial scroll (#1291)
* fix(web): require user intent to cancel initial scroll * fix(web): snapshot scroll intent before consumption
This commit is contained in:
@@ -200,7 +200,18 @@ describe('scroll anchor helpers', () => {
|
||||
distanceFromBottom: 182,
|
||||
isScrollingUp: true
|
||||
})
|
||||
expect(shouldCancelInitialScrollSettling(intent)).toBe(true)
|
||||
expect(shouldCancelInitialScrollSettling(intent, true)).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps initial scroll settling for programmatic upward movement', () => {
|
||||
const intent = getScrollIntent({
|
||||
scrollTop: 0,
|
||||
previousScrollTop: 700,
|
||||
scrollHeight: 1232,
|
||||
clientHeight: 530
|
||||
})
|
||||
|
||||
expect(shouldCancelInitialScrollSettling(intent, false)).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps initial scroll settling for negligible movement at the bottom', () => {
|
||||
@@ -215,7 +226,7 @@ describe('scroll anchor helpers', () => {
|
||||
distanceFromBottom: 0,
|
||||
isScrollingUp: false
|
||||
})
|
||||
expect(shouldCancelInitialScrollSettling(intent)).toBe(false)
|
||||
expect(shouldCancelInitialScrollSettling(intent, false)).toBe(false)
|
||||
})
|
||||
|
||||
it('restores the captured message to the same viewport offset', () => {
|
||||
|
||||
Reference in New Issue
Block a user