Skip to content

Conversation

@Aarekaz
Copy link
Owner

@Aarekaz Aarekaz commented Dec 1, 2025

Improved the input field detection in the global keyboard shortcut handler
to comprehensively check if the user is currently typing. This prevents
shortcuts like 'N', 'P', 'C', and 'S' from being triggered while editing
text in any input field, textarea, or contenteditable element.

The fix includes:

  • Checking both event target and active element
  • Detecting INPUT, TEXTAREA, and SELECT elements
  • Checking contentEditable elements
  • Using closest() to detect nested input elements

Fixes the issue where shortcuts were making the app unusable during normal typing.

… fields

Improved the input field detection in the global keyboard shortcut handler
to comprehensively check if the user is currently typing. This prevents
shortcuts like 'N', 'P', 'C', and 'S' from being triggered while editing
text in any input field, textarea, or contenteditable element.

The fix includes:
- Checking both event target and active element
- Detecting INPUT, TEXTAREA, and SELECT elements
- Checking contentEditable elements
- Using closest() to detect nested input elements

Fixes the issue where shortcuts were making the app unusable during normal typing.
@vercel
Copy link
Contributor

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
split-simple Ready Ready Preview Comment Dec 1, 2025 11:29pm

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 582 to 584
activeElement?.contentEditable === 'true' ||
activeElement?.isContentEditable ||
target.closest('input, textarea, select, [contenteditable="true"]') !== null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid calling closest on non-element key targets

The updated input detection now always calls target.closest(...), but the global keydown listener is attached to window (lines 775–778), where the event target is often the document when no input has focus. Document does not implement closest, so pressing any key while nothing focusable is active will throw a TypeError and halt all keyboard shortcuts before they run. Guard the call with an instanceof Element check or optional chaining to avoid crashing the handler when the target isn’t an element.

Useful? React with 👍 / 👎.

Prevent TypeError when keyboard events target non-element objects like
document. The closest() method only exists on Element instances, so we
must check with instanceof Element before calling it to avoid breaking
all keyboard shortcuts when no focusable element is active.
Three quality improvements:

1. PersonChip keyboard accessibility
   - Add tabIndex, role="button", and aria attributes
   - Support Enter and Space key activation
   - Only apply when onToggle prop is provided

2. SSR-safe localStorage access in MobileSpreadsheetView
   - Guard localStorage calls with typeof window check
   - Prevents potential hydration mismatches
   - Safer for Next.js SSR/SSG environments

3. Remove console.log in production
   - Clean up debug statement in bill loading logic
   - Silent early return when request is cancelled
The test was failing in CI because Google API keys were present in the
environment. Updated the test to explicitly clear all OCR-related API
keys before testing the warning behavior, ensuring consistent results
across different environments.
Change all single-key shortcuts to require Cmd/Ctrl modifiers to prevent
interference with Excel-like grid navigation. This allows users to type
directly in grid cells without triggering shortcuts.

New shortcuts:
- Cmd+Shift+N: Add new item (was: N)
- Cmd+Shift+P: Add person (was: P)
- Cmd+Shift+C: Copy summary (was: C)
- Cmd+S: Share (was: S)
- Cmd+N: New bill (unchanged)
- Cmd+Z: Undo (unchanged)
- Cmd+Shift+Z: Redo (unchanged)

This enables true Excel-like behavior where users can tab to cells and
immediately start typing without double-clicking.
Replace type="number" with type="text" and inputMode="decimal" for all
numeric inputs (price, quantity, tax, tip, discount). This:

- Removes ugly up/down spinner arrows on desktop
- Still shows numeric keyboard on mobile devices
- Provides cleaner, more professional appearance
- Matches Excel-like spreadsheet UX expectations

Users can now input numbers without the distracting spinners.
@Aarekaz Aarekaz merged commit 004eb3c into main Dec 2, 2025
4 of 6 checks passed
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.

3 participants