-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(boxai-sidebar): Arrow Key Navigation on Suggested Questions #3865
fix(boxai-sidebar): Arrow Key Navigation on Suggested Questions #3865
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be a fix(boxai-sidebar)
?
const handleKeyPress = React.useCallback((event: KeyboardEvent) => { | ||
if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) { | ||
event.stopPropagation(); | ||
} | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a storybook interactive test for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will do!
924c0ce
to
b838924
Compare
@@ -94,6 +94,20 @@ const BoxAISidebar = (props: BoxAISidebarProps) => { | |||
questionsWithoutInProgress = questionsWithoutInProgress.slice(0, -1); | |||
} | |||
|
|||
const handleKeyPress = React.useCallback((event: KeyboardEvent) => { | |||
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about Down and Up arrows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug appears only for Left and Right arrow keys, for the Arrow Up/Down it's not being propagated further
2a947d6
to
5a69aec
Compare
5a69aec
to
7c74dfb
Compare
7c74dfb
to
40939fe
Compare
Description
Using the up and down arrow keys for keyboard navigation while focused on suggested questions also changes the document page.
Steps to Reproduce:
To prevent this behavior callback with
stopPropagation()
was providedRecording
Screen.Recording.2025-01-24.at.17.08.31.mov