mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-08 01:53:34 +08:00
fix: DirectoryTree keyboard error (#32551)
* Fix bug in keyboard navigation When selecting a node using the keyboard (spacebar), the event received by onSelect has an undefined MouseEvent. Keyboard navigation was not possible because an error was thrown when trying to access properties from the undefined nativeEvent. We are now testing if nativeEvent is defined before accessing its properties. * fix: DirectoryTree throws error during keyboard navigation
This commit is contained in:
parent
413d979731
commit
0a8065e5bd
@ -161,8 +161,8 @@ const DirectoryTree: React.ForwardRefRenderFunction<RcTree, DirectoryTreeProps>
|
||||
};
|
||||
|
||||
// Windows / Mac single pick
|
||||
const ctrlPick: boolean = nativeEvent.ctrlKey || nativeEvent.metaKey;
|
||||
const shiftPick: boolean = nativeEvent.shiftKey;
|
||||
const ctrlPick: boolean = nativeEvent?.ctrlKey || nativeEvent?.metaKey;
|
||||
const shiftPick: boolean = nativeEvent?.shiftKey;
|
||||
|
||||
// Generate new selected keys
|
||||
let newSelectedKeys: Key[];
|
||||
|
Loading…
Reference in New Issue
Block a user