forked from EVOgeek/Vmeda.Online
		
	MOBILE-4362 core: Fix isElementVisible helper
Some elements return 0 for clientWidth even if they have a size in the final rendering, so we'll use getBoundingClientRect which is more reliable.
This commit is contained in:
		
							parent
							
								
									aebbe3365c
								
							
						
					
					
						commit
						781a4da551
					
				| @ -123,8 +123,12 @@ export class CoreDom { | |||||||
|      * @returns True if element is visible inside the DOM. |      * @returns True if element is visible inside the DOM. | ||||||
|      */ |      */ | ||||||
|     static isElementVisible(element: HTMLElement, checkSize = true): boolean { |     static isElementVisible(element: HTMLElement, checkSize = true): boolean { | ||||||
|         if (checkSize && (element.clientWidth === 0 || element.clientHeight === 0)) { |         if (checkSize) { | ||||||
|             return false; |             const dimensions = element.getBoundingClientRect(); | ||||||
|  | 
 | ||||||
|  |             if (dimensions.width === 0 || dimensions.height === 0) { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         const style = getComputedStyle(element); |         const style = getComputedStyle(element); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user