Skip to content

fix: focus comment composer when ready#6090

Merged
rebelchris merged 3 commits into
mainfrom
codex/fix-comment-composer-focus
May 21, 2026
Merged

fix: focus comment composer when ready#6090
rebelchris merged 3 commits into
mainfrom
codex/fix-comment-composer-focus

Conversation

@rebelchris
Copy link
Copy Markdown
Contributor

@rebelchris rebelchris commented May 21, 2026

Summary

  • Focus the newly opened desktop comment composer from the comment click handler
  • Expose a stable input id on the rich editor DOM so it can be focused directly
  • Keep the rich editor exposed as a multiline textbox for accessibility and existing tests
  • Let the top-level comment composer opt out of the old eager autofocus path
  • Add regression coverage for click-triggered focus and editor DOM id wiring

Tests

  • pnpm --filter shared test -- src/components/fields/RichTextInput.spec.tsx src/components/post/NewComment.spec.tsx src/components/comments/MainComment.spec.tsx src/components/comments/SubComment.spec.tsx
  • NODE_ENV=test pnpm --filter webapp exec jest __tests__/PostPage.tsx --runInBand -t "should open new comment modal and set the correct props"
  • node ./scripts/typecheck-strict-changed.js
  • git diff --check

Preview: https://fix-comment-composer-focus.preview.app.daily.dev

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

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

Project Deployment Actions Updated (UTC)
daily-webapp Ready Ready Preview May 21, 2026 1:54pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
storybook Ignored Ignored May 21, 2026 1:54pm

Request Review

Comment on lines +537 to +549
useEffect(() => {
if (!pendingFocusRef.current) {
return undefined;
}

const frame = requestAnimationFrame(() => {
if (focusEditorInput()) {
pendingFocusRef.current = false;
}
});

return () => cancelAnimationFrame(frame);
}, [focusEditorInput]);
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.

Sounds like focus should be in click handler not useEffect, maybe editor exposes id/data-*/attribute so that it can be focused in dom

@rebelchris rebelchris force-pushed the codex/fix-comment-composer-focus branch from 26e4139 to 86e7d8e Compare May 21, 2026 13:10
@rebelchris rebelchris requested a review from capJavert May 21, 2026 13:56
@rebelchris rebelchris merged commit 74e4ad5 into main May 21, 2026
12 checks passed
@rebelchris rebelchris deleted the codex/fix-comment-composer-focus branch May 21, 2026 13:57
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