File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -244,18 +244,17 @@ export class StudyChapterScroller {
244244
245245 scrollIfNeeded ( list : HTMLElement ) {
246246 if ( ! this . request ) return ;
247+ const active = list . querySelector ( '.active' ) ;
248+ if ( ! active ) return ;
247249 const request = this . request ;
248250 this . request = undefined ;
249- const active = list . querySelector ( '.active' ) ;
250- if ( active ) {
251- const [ c , l ] = [ list . getBoundingClientRect ( ) , active . getBoundingClientRect ( ) ] ;
252- if ( c . top < l . top || c . bottom > l . bottom ) {
253- cancelAnimationFrame ( this . rafId ?? 0 ) ;
254- this . rafId = requestAnimationFrame ( ( ) => {
255- scrollToInnerSelector ( list , '.active' , false , request ) ;
256- this . rafId = undefined ;
257- } ) ;
258- }
251+ const [ c , l ] = [ list . getBoundingClientRect ( ) , active . getBoundingClientRect ( ) ] ;
252+ if ( c . top < l . top || c . bottom > l . bottom ) {
253+ cancelAnimationFrame ( this . rafId ?? 0 ) ;
254+ this . rafId = requestAnimationFrame ( ( ) => {
255+ scrollToInnerSelector ( list , '.active' , false , request ) ;
256+ this . rafId = undefined ;
257+ } ) ;
259258 }
260259 }
261260}
You can’t perform that action at this time.
0 commit comments