Skip to content

Fix comment Post button staying disabled after pasting - #3172

Open
piotrsynowiec wants to merge 1 commit into
basecamp:mainfrom
piotrsynowiec:codex/comment-submit-validity
Open

piotrsynowiec wants to merge 1 commit into
basecamp:mainfrom
piotrsynowiec:codex/comment-submit-validity

Conversation

@piotrsynowiec

Copy link
Copy Markdown

Pasting a comment into an empty composer can leave Post disabled until another key is pressed, particularly in Safari. The comment is already present and valid, so submitting with Cmd+Enter can work while the button remains disabled.

Lexxy 0.9.32 dispatches lexxy:change before scheduling its validity refresh for the next animation frame. form#disableSubmitWhenInvalid schedules its check for that same frame, so the check can run before Lexxy clears the previous valueMissing state. Wait one additional frame before reading the existing form validity. Required-field and attachment validation remain in place.

Reproduction: open a card with an empty comment composer in Safari, paste a complete comment once, and do not press another key. Before the change, Post remains disabled; with the change it enables and clicking it posts the comment successfully.

Validation:

  • The new single-content-update regression test fails on the original code at the enabled-Post assertion and passes with this change.
  • Chromium system tests: 4 tests, 28 assertions, no failures or errors (single update/clear/post, restored draft, keyboard submission, existing attachment/lightbox test).
  • Desktop Safari browser review: reproduced the disabled button before the fix; one paste enables Post after the fix, clicking Post saves the comment, and the empty composer returns with Post disabled.
  • RuboCop passes for the new test; git diff --check passes.
  • Full suite and iOS Safari were not run. Browser evidence is from a local preview with disposable sample cards; this fix has not been deployed to production.

Local Safari review: one paste enables Post

Detailed browser evidence and regression checks.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 21:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approved

The focused timing fix preserves validation and has appropriate system-test coverage.

0 open findings

What changed in this PR

Fixes comment submission validity timing after paste or draft restoration.

Changes:

  • Waits an additional animation frame before checking form validity.
  • Adds regression coverage for content updates, drafts, and keyboard submission.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
app/​javascript/​controllers/​form_controller.js Defers validity checking until Lexxy finishes refreshing.
test/​system/​comment_submission_test.rb Tests comment submission state and related workflows.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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