Skip to content

edit submit fix on mobile#2027

Merged
simo6529 merged 4 commits intomainfrom
mobile-edit-and-space-does-submit
Mar 2, 2026
Merged

edit submit fix on mobile#2027
simo6529 merged 4 commits intomainfrom
mobile-edit-and-space-does-submit

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Mar 2, 2026

Summary by CodeRabbit

  • New Features

    • Improved device-aware behavior: app/mobile detection adjusts keyboard handling and UI hints.
    • Enter on mobile/app no longer submits; desktop shortcuts shown only on non-mobile contexts.
    • Action buttons and mention interactions remain visible and better suited to mobile.
  • Tests

    • Expanded tests covering mobile-specific interactions, keyboard behavior, and mention handling.

Signed-off-by: Simo <simo@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

The PR adds device-aware behavior to EditDropLexical: it detects app/mobile contexts and propagates an isMobileOrApp flag to KeyboardPlugin to suppress Enter-key submission on mobile/app, adjusts UI keyboard hint text, and updates tests and mocks to cover mobile-specific interactions.

Changes

Cohort / File(s) Summary
Test Updates for Device-Aware Behavior
__tests__/components/waves/drops/EditDropLexical.test.tsx
Expanded test suite with device-info mocks (isApp, isMobileDevice), replaced/updated Lexical and mentions plugin mocks (WaveMentionsPlugin, MentionNode wrappers), added mobile-specific tests (Enter suppression, UI visibility), and adjusted expected onSave payloads and mention formats.
Component Device-Aware Keyboard Handling
components/waves/drops/EditDropLexical.tsx
Introduced useDeviceInfo() usage, derived `isMobileOrApp = isMobileDevice

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EditDropLexical
    participant KeyboardPlugin
    participant EditorHandler
    User->>EditDropLexical: Focus & keypress (Enter/Escape)
    Note right of EditDropLexical: derives isMobileOrApp via useDeviceInfo()
    EditDropLexical->>KeyboardPlugin: handleKey(event, isMobileOrApp)
    alt isMobileOrApp == true
        KeyboardPlugin-->>EditDropLexical: suppress Enter (no submit)
        KeyboardPlugin->>EditorHandler: allow Escape/onCancel if applicable
    else isMobileOrApp == false
        KeyboardPlugin->>EditorHandler: trigger onSave on Enter or onCancel on Escape
    end
    EditorHandler-->>User: update UI / saved state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Mentioned users edit mode fix #1494 — touches mention reconstruction logic and tests (TextNode/selectEnd, reconstructSplitMention), overlaps with updated mention handling here.
  • Syntax-highlighted code blocks  #1500 — modifies EditDropLexical.tsx including KeyboardPlugin props and code-node handling; directly related to the component changes.
  • Wave mention bug #2015 — extends Wave mention/typeahead code and tests (WaveMentionsPlugin/TypeaheadMenu), related to the updated mention plugin mocks and payload formatting.

Suggested reviewers

  • ragnep
  • prxt6529

Poem

🐰 In code I hop, with ears alert and fleet,
Enter pauses softly on a mobile beat,
Hints tuck away where small screens play,
Tests and plugins shaped to light the way,
A tiny spring of change — delightful, neat! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'edit submit fix on mobile' directly aligns with the main change: preventing form submission on mobile devices by implementing device-aware behavior in the EditDropLexical component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mobile-edit-and-space-does-submit

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@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.

Reviewed commit: 9a7972ba14

ℹ️ 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 thread components/waves/drops/EditDropLexical.tsx
Signed-off-by: Simo <simo@6529.io>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/waves/drops/EditDropLexical.tsx (1)

378-390: ⚠️ Potential issue | 🟠 Major

Mobile/app Enter branch currently blocks both submit and newline insertion.

At line 389, returning true marks KEY_ENTER_COMMAND as handled, which stops propagation to Lexical's default Enter handlers. This prevents both form submission (intended) and newline insertion (unintended). On mobile/app, users cannot press Enter to add line breaks; only Shift+Enter works.

Change to return false so that Lexical's default Enter behavior runs and inserts line breaks, while still preventing the save/cancel logic from executing.

Proposed fix
-        if (isMobileOrApp) {
-          return true;
-        }
+        if (isMobileOrApp) {
+          return false;
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/waves/drops/EditDropLexical.tsx` around lines 378 - 390, The
mobile/app branch in the KEY_ENTER_COMMAND handler (registered via
editor.registerCommand in removeEnterListener) incorrectly returns true which
marks the Enter key as handled and blocks Lexical's default newline insertion;
update the handler so that when isMobileOrApp is true it returns false instead
(while keeping the earlier checks that return false if
mentionsRef.current?.isMentionsOpen() or
waveMentionsRef.current?.isWaveMentionsOpen()) so Lexical's default Enter
behavior inserts line breaks on mobile but the save/cancel logic elsewhere
remains unaffected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@components/waves/drops/EditDropLexical.tsx`:
- Around line 378-390: The mobile/app branch in the KEY_ENTER_COMMAND handler
(registered via editor.registerCommand in removeEnterListener) incorrectly
returns true which marks the Enter key as handled and blocks Lexical's default
newline insertion; update the handler so that when isMobileOrApp is true it
returns false instead (while keeping the earlier checks that return false if
mentionsRef.current?.isMentionsOpen() or
waveMentionsRef.current?.isWaveMentionsOpen()) so Lexical's default Enter
behavior inserts line breaks on mobile but the save/cancel logic elsewhere
remains unaffected.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a7972b and 7128e80.

📒 Files selected for processing (1)
  • components/waves/drops/EditDropLexical.tsx

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 2, 2026

@simo6529 simo6529 merged commit abd156e into main Mar 2, 2026
7 checks passed
@simo6529 simo6529 deleted the mobile-edit-and-space-does-submit branch March 2, 2026 14:48
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.

2 participants