mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-11-04 10:11:03 +01:00 
			
		
		
		
	Merge pull request #3522 from matrix-org/t3chguy/backspace_cider_focus
Limit Backspace-consuming workaround to just Slate, tidy Keyboard :)
This commit is contained in:
		
						commit
						b1b4139163
					
				@ -66,7 +66,10 @@ export const Key = {
 | 
				
			|||||||
    End: "End",
 | 
					    End: "End",
 | 
				
			||||||
    PAGE_UP: "PageUp",
 | 
					    PAGE_UP: "PageUp",
 | 
				
			||||||
    PAGE_DOWN: "PageDown",
 | 
					    PAGE_DOWN: "PageDown",
 | 
				
			||||||
 | 
					    BACKSPACE: "Backspace",
 | 
				
			||||||
    BACKTICK: "`",
 | 
					    BACKTICK: "`",
 | 
				
			||||||
 | 
					    SPACE: " ",
 | 
				
			||||||
 | 
					    ENTER: "Enter",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    K: "k",
 | 
					    K: "k",
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -399,10 +399,11 @@ const LoggedInView = createReactClass({
 | 
				
			|||||||
            ev.preventDefault();
 | 
					            ev.preventDefault();
 | 
				
			||||||
        } else if (!hasModifier) {
 | 
					        } else if (!hasModifier) {
 | 
				
			||||||
            const isClickShortcut = ev.target !== document.body &&
 | 
					            const isClickShortcut = ev.target !== document.body &&
 | 
				
			||||||
                (ev.key === "Space" || ev.key === "Enter");
 | 
					                (ev.key === Key.SPACE || ev.key === Key.ENTER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // XXX: Remove after CIDER replaces Slate completely: https://github.com/vector-im/riot-web/issues/11036
 | 
					            // XXX: Remove after CIDER replaces Slate completely: https://github.com/vector-im/riot-web/issues/11036
 | 
				
			||||||
            if (ev.key === "Backspace") {
 | 
					            // If using Slate, consume the Backspace without first focusing as it causes an implosion
 | 
				
			||||||
 | 
					            if (ev.key === Key.BACKSPACE && !SettingsStore.getValue("useCiderComposer")) {
 | 
				
			||||||
                ev.stopPropagation();
 | 
					                ev.stopPropagation();
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user