fix(ui): keep Create Project form open when Escape dismisses a child picker#258
fix(ui): keep Create Project form open when Escape dismisses a child picker#258martian56 wants to merge 1 commit into
Conversation
…picker Pressing Escape to close the cover or icon picker tore down the whole Create Project modal and discarded any typed data, because the modal's Escape handler called the raw onClose and both listeners fired on the same keypress. The handler now runs handleClose (which resets form state for a clean reopen) and no-ops while a child picker is open, so Escape only dismisses the picker. Split the member fetch into its own effect so re-registering the listener no longer refetches members. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughCreateProjectModal.tsx memoizes handleClose using useCallback and refactors Escape-key handling into a separate effect. The new effect closes the modal via handleClose only when neither the cover picker nor the icon picker is open, preventing premature form resets while nested pickers are active. ChangesEscape Key Close Behavior Fix
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CreateProjectModal
participant CoverIconPickers
User->>CreateProjectModal: Press Escape
CreateProjectModal->>CreateProjectModal: Check open, coverModalOpen, iconModalOpen
alt picker open
CreateProjectModal->>CoverIconPickers: Escape closes picker only
else no picker open
CreateProjectModal->>CreateProjectModal: handleClose() resets form and closes
end
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Closes #142.
Pressing Escape to dismiss the cover or icon picker inside the Create Project modal used to tear down the entire modal and discard everything the user had typed. The modal's Escape handler called the raw
onClose(which does not reset form state), and because the picker registers its own Escape listener, a single keypress fired both handlers at once.The Escape handler now:
handleClose()instead of the rawonClose, so the form state is reset for a clean reopen, andcoverModalOpen || iconModalOpen), so Escape only dismisses the picker and leaves the form (and typed data) intact.The workspace-member fetch and body-overflow lock were split into their own effect so re-registering the Escape listener no longer refetches members.
Testing
npm run typecheckandnpm run lintpass.AI assistance
This change was produced with the help of Claude Code (Claude Opus 4.8). See the
Co-Authored-Bytrailer on the commit.Summary by CodeRabbit