feat(controller): consider hasScrollbarSignal when detecting scrollable
This commit is contained in:
@@ -503,11 +503,16 @@ export default (
|
||||
const overflowX = style.overflowX
|
||||
const overflowY = style.overflowY
|
||||
|
||||
// Check scrollable distances
|
||||
// scrollbar-width/scrollbar-gutter are only set on elements designed to scroll;
|
||||
// their presence signals scroll intent even when overflow is hidden (e.g. overflow: auto on :hover)
|
||||
const hasScrollbarSignal =
|
||||
(style.scrollbarWidth && style.scrollbarWidth !== 'auto') ||
|
||||
(style.scrollbarGutter && style.scrollbarGutter !== 'auto')
|
||||
|
||||
const scrollableX = overflowX === 'auto' || overflowX === 'scroll'
|
||||
const scrollableY = overflowY === 'auto' || overflowY === 'scroll'
|
||||
|
||||
if (!scrollableX && !scrollableY) {
|
||||
if (!scrollableX && !scrollableY && !hasScrollbarSignal) {
|
||||
return null // Not scrollable in any direction
|
||||
}
|
||||
|
||||
@@ -521,11 +526,11 @@ export default (
|
||||
return null // Not scrollable
|
||||
}
|
||||
|
||||
if (!scrollableY && scrollWidth < threshold) {
|
||||
if (!scrollableY && !hasScrollbarSignal && scrollWidth < threshold) {
|
||||
return null // Not scrollable horizontally
|
||||
}
|
||||
|
||||
if (!scrollableX && scrollHeight < threshold) {
|
||||
if (!scrollableX && !hasScrollbarSignal && scrollHeight < threshold) {
|
||||
return null // Not scrollable vertically
|
||||
}
|
||||
|
||||
@@ -547,6 +552,8 @@ export default (
|
||||
scrollData: scrollData,
|
||||
})
|
||||
|
||||
console.log('scrollData!!!', scrollData)
|
||||
|
||||
return scrollData
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user