fix(frontend/scroll): no callback for disconnected elements (#11714)
* fix(frontend/scroll): no callback for disconnected elements * Update CHANGELOG.md
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							bbef2a953e
						
					
				
				
					commit
					ab58b651f7
				
			@@ -30,7 +30,7 @@ export function getScrollPosition(el: HTMLElement | null): number {
 | 
			
		||||
 | 
			
		||||
export function onScrollTop(el: HTMLElement, cb: () => unknown, tolerance = 1, once = false) {
 | 
			
		||||
	// とりあえず評価してみる
 | 
			
		||||
	if (isTopVisible(el)) {
 | 
			
		||||
	if (el.isConnected && isTopVisible(el)) {
 | 
			
		||||
		cb();
 | 
			
		||||
		if (once) return null;
 | 
			
		||||
	}
 | 
			
		||||
@@ -54,7 +54,7 @@ export function onScrollBottom(el: HTMLElement, cb: () => unknown, tolerance = 1
 | 
			
		||||
	const container = getScrollContainer(el);
 | 
			
		||||
 | 
			
		||||
	// とりあえず評価してみる
 | 
			
		||||
	if (isBottomVisible(el, tolerance, container)) {
 | 
			
		||||
	if (el.isConnected && isBottomVisible(el, tolerance, container)) {
 | 
			
		||||
		cb();
 | 
			
		||||
		if (once) return null;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user