@@ -156,9 +156,21 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({
156
156
const style = window . getComputedStyle ( el )
157
157
return [ 'auto' , 'scroll' ] . includes ( style . overflowY ! ) && el . scrollHeight > el . clientHeight
158
158
} ,
159
- shouldScroll ( el : Element , delta : number ) {
160
- if ( el . scrollTop === 0 && delta < 0 ) return true
161
- return el . scrollTop + el . clientHeight === el . scrollHeight && delta > 0
159
+ shouldScroll ( el : Element , delta : number ) : boolean {
160
+ if ( el . hasAttribute ( 'data-app' ) ) return false
161
+
162
+ const alreadyAtTop = el . scrollTop === 0
163
+ const alreadyAtBottom = el . scrollTop + el . clientHeight === el . scrollHeight
164
+ const scrollingUp = delta < 0
165
+ const scrollingDown = delta > 0
166
+
167
+ if ( ! alreadyAtTop && scrollingUp ) return true
168
+ if ( ! alreadyAtBottom && scrollingDown ) return true
169
+ if ( ( alreadyAtTop || alreadyAtBottom ) ) {
170
+ return this . shouldScroll ( el . parentNode as Element , delta )
171
+ }
172
+
173
+ return false
162
174
} ,
163
175
isInside ( el : Element , parent : Element ) : boolean {
164
176
if ( el === parent ) {
@@ -178,7 +190,7 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({
178
190
// getSelection returns null in firefox in some edge cases, can be ignored
179
191
const selected = window . getSelection ( ) ! . anchorNode as Element
180
192
if ( dialog && this . hasScrollbar ( dialog ) && this . isInside ( selected , dialog ) ) {
181
- return this . shouldScroll ( dialog , delta )
193
+ return ! this . shouldScroll ( dialog , delta )
182
194
}
183
195
return true
184
196
}
@@ -190,7 +202,7 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({
190
202
if ( el === document . documentElement ) return true
191
203
if ( el === this . $refs . content ) return true
192
204
193
- if ( this . hasScrollbar ( el as Element ) ) return this . shouldScroll ( el as Element , delta )
205
+ if ( this . hasScrollbar ( el as Element ) ) return ! this . shouldScroll ( el as Element , delta )
194
206
}
195
207
196
208
return true
0 commit comments