RoyLee1224 commented on code in PR #58642:
URL: https://github.com/apache/airflow/pull/58642#discussion_r2566661633
##########
airflow-core/src/airflow/ui/src/hooks/navigation/useKeyboardNavigation.ts:
##########
@@ -57,11 +62,29 @@ export const useKeyboardNavigation = ({ enabled = true,
onNavigate, onToggleGrou
[onNavigate],
);
- const handleNormalKeyPress = createKeyHandler();
-
const hotkeyOptions = { enabled, preventDefault: true };
- useHotkeys(ARROW_KEYS.join(","), handleNormalKeyPress, hotkeyOptions,
[onNavigate]);
+ useHotkeys(ARROW_KEYS.join(","), handleKeyDown, hotkeyOptions, [onNavigate]);
useHotkeys("space", () => onToggleGroup?.(), hotkeyOptions, [onToggleGroup]);
+
+ // Handle keyup: commit navigation (URL update)
+ useEffect(() => {
+ if (!enabled || !onCommit) {
+ return undefined;
+ }
+
+ const handleKeyUp = (event: KeyboardEvent) => {
+ // Only commit when shift + arrow key is released
+ if (isArrowKey(event.key)) {
+ onCommit();
Review Comment:
Makes sense, I tried debounce and it does look better for rapid short presses
##########
airflow-core/src/airflow/ui/src/hooks/navigation/useKeyboardNavigation.ts:
##########
@@ -57,11 +62,29 @@ export const useKeyboardNavigation = ({ enabled = true,
onNavigate, onToggleGrou
[onNavigate],
);
- const handleNormalKeyPress = createKeyHandler();
-
const hotkeyOptions = { enabled, preventDefault: true };
- useHotkeys(ARROW_KEYS.join(","), handleNormalKeyPress, hotkeyOptions,
[onNavigate]);
+ useHotkeys(ARROW_KEYS.join(","), handleKeyDown, hotkeyOptions, [onNavigate]);
useHotkeys("space", () => onToggleGroup?.(), hotkeyOptions, [onToggleGroup]);
+
+ // Handle keyup: commit navigation (URL update)
+ useEffect(() => {
+ if (!enabled || !onCommit) {
+ return undefined;
+ }
+
+ const handleKeyUp = (event: KeyboardEvent) => {
+ // Only commit when shift + arrow key is released
+ if (isArrowKey(event.key)) {
+ onCommit();
Review Comment:
Makes sense, I tried debounce and it does look better for rapid presses
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]