Skip to content

fix(grid): prevent double commit and consume Enter key events in GridCellEditor #905

Description

@ZhuchkaTriplesix

Summary

In GridCellEditor (lib/features/workspace/grid_cell_editor.dart), inline cell editing handles keyboard events using a KeyboardListener wrapping a TextField.

When the user presses Enter (or Shift+Enter):

  1. _handleKeyEvent in KeyboardListener catches KeyDownEvent and invokes widget.onCommit(_controller.text, moveNextRow: true).
  2. Because KeyboardListener does not consume or handle the key event (unlike Focus.onKeyEvent returning KeyEventResult.handled), the Enter event continues to propagate into the internal text input connection.
  3. TextField fires its onSubmitted: (value) { widget.onCommit(value, moveNextRow: true); }, executing a second commit on the freshly navigated row or causing cursor jumps and inconsistent staging state.

Repro

  1. Double-click any cell in table browser to edit inline.
  2. Type a value and press Enter.
  3. Observe onCommit is invoked twice in rapid succession, which can advance selection past the intended row or trigger double staging events.

Scope

  • Migrate KeyboardListener in GridCellEditor to Focus(onKeyEvent: ...) and return KeyEventResult.handled when Enter, Tab, or Escape are handled.
  • Remove redundant onSubmitted handler from TextField (or guard against redundant commits while unmounting).

Out of scope

  • Popover inspector dialog keyboard shortcuts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingdata-gridInteractive data grid, cell editor, filtering, groupings

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions