[codex] fix: keep settings Escape local to edit fields#3534
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved Small, self-contained bug fix that prevents the Escape key from navigating away when typing in editable fields. The change adds a straightforward guard condition with clear intent and no side effects. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
…able-guard [codex] fix: keep settings Escape local to edit fields
629ae00 to
a0f1ff3
Compare
Summary
Root cause
The settings route window keydown handler handled every unprevented Escape before checking whether the event came from an editable control.
Impact
Escape no longer leaves settings edit fields or closes a Base UI select trigger unexpectedly. Non-editable focus still uses the existing settings back navigation.
Validation
PATH="$HOME/.vite-plus/bin:$PATH" vp checkPATH="$HOME/.vite-plus/bin:$PATH" vp run typecheckNote
Low Risk
Localized keyboard routing in the settings route only; no auth, data, or API changes.
Overview
Escape in settings no longer navigates away when the key is pressed while focus is inside an editable control.
SettingsContentLayout’s window-level Escape handler now bails out if the event’s composed path includes native inputs, textareas, selects,[data-slot="select-trigger"](shared UI select), contenteditable regions, orrole="textbox". A smalleventPathContainsSelectorhelper walksevent.composedPath()(with aevent.targetfallback) to detect those targets. Back navigation on Escape is unchanged when focus is outside those elements.Reviewed by Cursor Bugbot for commit a0f1ff3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix Escape key in settings to skip navigation when focus is within editable fields
The
SettingsContentLayoutkeydown handler in settings.tsx previously navigated back on every Escape keypress. It now checks whether the event originated from an input, textarea, select, contenteditable, orrole="textbox"element and skips navigation if so, using a neweventPathContainsSelectorutility that walksevent.composedPath().Macroscope summarized a0f1ff3.