fix: allow Backspace/Delete in Dataframe header edit mode#13027
Open
mango766 wants to merge 1 commit intogradio-app:mainfrom
Open
fix: allow Backspace/Delete in Dataframe header edit mode#13027mango766 wants to merge 1 commit intogradio-app:mainfrom
mango766 wants to merge 1 commit intogradio-app:mainfrom
Conversation
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
Member
|
Have you tested this @mango766? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()inkeyboard_utils.ts. When a header is being edited (header_edit !== false), the call chain goes:handle_header_navigationreturnsfalse(line 55) — by design, it doesn't handle text-editing keys whenheader_editis activehandle_delete_operationis called next and matches on Backspace/Delete (line 98)editing(the cell editing state) isfalseduring header editing, the guard block at lines 108-123 is skipped entirelyevent.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: ifheader_editis active, returnfalseimmediately so the event propagates to the textarea.Changes
js/dataframe/shared/utils/keyboard_utils.ts: Addedif (state.ui_state.header_edit !== false) return false;after the key check inhandle_delete_operationCloses #12441