-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Disable cell navigation while editing, add column.editorOptions.onNavigation #2196
Conversation
Using tab during editing is quite common and I am not sure if we can completely disable it. Having an option to control the editing would be nice though |
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.
Looks good overall
src/utils/columnUtils.ts
Outdated
* By default, the following navigation keys are enabled while an editor is open, under specific conditions: | ||
* - Tab: | ||
* - The editor must be an <input>, a <textarea>, or a <select> element. | ||
* - The editor element must be the only immmediate child of the editor container. |
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.
Would it break if input has a container element like a label?
div.rdg-editor-container > label > input
@@ -722,6 +723,10 @@ function DataGrid<R, SR>({ | |||
} | |||
|
|||
function navigate(event: React.KeyboardEvent<HTMLDivElement>) { | |||
if (selectedPosition.mode === 'EDIT') { | |||
const onNavigation = columns[selectedPosition.idx].editorOptions?.onNavigation ?? onEditorNavigation; |
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 can probably add an example of custom onEditorNavigation
like
- Navigate left if the cursor is at position 0
- Navigate right if the cursor is at position selection.length
No description provided.