Page Display: Fixed highlighting for elements in nested details
For #4878
This commit is contained in:
		
							parent
							
								
									8e01345f14
								
							
						
					
					
						commit
						5a5f0b8de9
					
				| 
						 | 
				
			
			@ -31,9 +31,12 @@ export function debounce(func, waitMs, immediate) {
 | 
			
		|||
export function scrollAndHighlightElement(element) {
 | 
			
		||||
    if (!element) return;
 | 
			
		||||
 | 
			
		||||
    const parentDetails = element.closest('details');
 | 
			
		||||
    if (parentDetails && !parentDetails.open) {
 | 
			
		||||
        parentDetails.open = true;
 | 
			
		||||
    let parent = element;
 | 
			
		||||
    while (parent.parentElement) {
 | 
			
		||||
        parent = parent.parentElement;
 | 
			
		||||
        if (parent.nodeName === 'DETAILS' && !parent.open) {
 | 
			
		||||
            parent.open = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    element.scrollIntoView({behavior: 'smooth'});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue