Skip to content

fix: allow Backspace/Delete in Dataframe header edit mode#13027

Open
mango766 wants to merge 1 commit intogradio-app:mainfrom
mango766:fix/dataframe-header-backspace
Open

fix: allow Backspace/Delete in Dataframe header edit mode#13027
mango766 wants to merge 1 commit intogradio-app:mainfrom
mango766:fix/dataframe-header-backspace

Conversation

@mango766
Copy link

Description

Pressing Backspace or Delete while editing a column header in the Dataframe component does nothing — the keypress is swallowed.

The root cause is in handle_keydown() in keyboard_utils.ts. When a header is being edited (header_edit !== false), the call chain goes:

  1. handle_header_navigation returns false (line 55) — by design, it doesn't handle text-editing keys when header_edit is active
  2. handle_delete_operation is called next and matches on Backspace/Delete (line 98)
  3. Since editing (the cell editing state) is false during header editing, the guard block at lines 108-123 is skipped entirely
  4. Execution reaches event.preventDefault() at line 125, which blocks the keypress from reaching the header's <textarea>

The fix adds one guard at the top of handle_delete_operation: if header_edit is active, return false immediately so the event propagates to the textarea.

Changes

  • js/dataframe/shared/utils/keyboard_utils.ts: Added if (state.ui_state.header_edit !== false) return false; after the key check in handle_delete_operation

Closes #12441

handle_delete_operation() in keyboard_utils.ts intercepts
Backspace/Delete key events even when the user is editing a column
header. This happens because the function checks the cell editing
state but doesn't account for header editing, causing
event.preventDefault() to block normal text editing in the header
textarea.

Add an early return when header_edit is active so these key events
propagate to the header textarea as expected.

Closes gradio-app#12441
@pngwn
Copy link
Member

pngwn commented Mar 17, 2026

Have you tested this @mango766?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dataframe interactive backspace not working on headers

2 participants