Skip to content

Call onRowsChange when using keyboard navigation(arrows). #2659

Answered by amanmahajan7
keepyourarrow asked this question in Q&A
Discussion options

You must be logged in to vote

You can use column.editorOptions.onNavigation to override the default behavior.

something like

function onEditorNavigation({ key, target }: React.KeyboardEvent<HTMLDivElement>): boolean {
  if (
    key === 'Tab' &&
    (target instanceof HTMLInputElement ||
      target instanceof HTMLTextAreaElement ||
      target instanceof HTMLSelectElement)
  ) {
    return target.matches(
      '.rdg-editor-container > :only-child, .rdg-editor-container > label:only-child > :only-child'
    );
  }
  return false;
}

...
const columns = [{
 ...
 key: 'name',
 editor: TextEditor,
 editorOptions={{
   onNavigation(event) {
     return onEditorNavigation(event) || event.key.startsWith('Arrow')';
   }
}]

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by amanmahajan7
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2611 on September 14, 2021 14:00.