[Editor] Only get back the focus when it has been lost after an editor has been moved in the DOM
This commit is contained in:
		
							parent
							
								
									221ee6ca37
								
							
						
					
					
						commit
						5646604883
					
				@ -398,6 +398,7 @@ class AnnotationEditorLayer {
 | 
				
			|||||||
      // re-enable them when the editor has the focus.
 | 
					      // re-enable them when the editor has the focus.
 | 
				
			||||||
      editor._focusEventsAllowed = false;
 | 
					      editor._focusEventsAllowed = false;
 | 
				
			||||||
      setTimeout(() => {
 | 
					      setTimeout(() => {
 | 
				
			||||||
 | 
					        if (!editor.div.contains(document.activeElement)) {
 | 
				
			||||||
          editor.div.addEventListener(
 | 
					          editor.div.addEventListener(
 | 
				
			||||||
            "focusin",
 | 
					            "focusin",
 | 
				
			||||||
            () => {
 | 
					            () => {
 | 
				
			||||||
@ -406,6 +407,9 @@ class AnnotationEditorLayer {
 | 
				
			|||||||
            { once: true }
 | 
					            { once: true }
 | 
				
			||||||
          );
 | 
					          );
 | 
				
			||||||
          activeElement.focus();
 | 
					          activeElement.focus();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          editor._focusEventsAllowed = true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }, 0);
 | 
					      }, 0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user