Fix prompt keyboard navigation inside tables#718
Fix prompt keyboard navigation inside tables#718yanfroes wants to merge 4 commits intobasecamp:mainfrom
Conversation
When a prompt (e.g., @ mentions) is open inside a table cell, arrow keys should navigate the dropdown options, not the table cells. Changed prompt key handlers from COMMAND_PRIORITY_HIGH to COMMAND_PRIORITY_CRITICAL so they run before table navigation handlers. Fixes basecamp#677
There was a problem hiding this comment.
Pull request overview
This PR fixes keyboard navigation for prompt dropdowns (e.g., @ mentions) when used inside table cells by changing the priority of keyboard event handlers from COMMAND_PRIORITY_HIGH to COMMAND_PRIORITY_CRITICAL.
Changes:
- Updated keyboard command registration priorities in
prompt.jsfromCOMMAND_PRIORITY_HIGHtoCOMMAND_PRIORITY_CRITICALfor all key handlers (ENTER, TAB, SPACE, ARROW_UP, ARROW_DOWN) - Imported
COMMAND_PRIORITY_CRITICALfrom Lexical - Updated comments to reflect the new priority level
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
I like this, a simple solution, thank you @yanfroes! @samuelpecher any feedback on this? |
samuelpecher
left a comment
There was a problem hiding this comment.
LGTM; I wouldn't want to push the table handle commands down the priority list, so 👍
samuelpecher
left a comment
There was a problem hiding this comment.
This could do with a test to ensure we don't regress in the future if priorities are ever revised.
Adds regression test for basecamp#677 to ensure arrow keys navigate prompt items when the prompt is opened inside a table cell. Verifies that prompt key handlers maintain COMMAND_PRIORITY_CRITICAL to prevent the table plugin from intercepting arrow key events.
|
@zoltanhosszu @samuelpecher Just added the test! =) |
zoltanhosszu
left a comment
There was a problem hiding this comment.
Looking solid! Let's ship it :) 🚀
Fixes #677
Problem
When using @ mentions (or other prompts) inside a table cell, pressing arrow keys navigates between table cells instead of navigating the dropdown options.
Cause
Lexical's table plugin registers arrow key handlers at COMMAND_PRIORITY_HIGH during editor initialization. The prompt also registered its handlers at the same priority, but later—causing table handlers to intercept keyboard events first.
Solution
Changed prompt key handlers from COMMAND_PRIORITY_HIGH to COMMAND_PRIORITY_CRITICAL, ensuring they take precedence over table navigation when the prompt is open.
lexxy-fix-prompt-keyboard-navigation-inside-tables.mp4