Skip to content

🐛 Fixed link selection in automations email editor#28967

Closed
troyciesco wants to merge 1 commit into
mainfrom
NY-1394_atmns-editor-links
Closed

🐛 Fixed link selection in automations email editor#28967
troyciesco wants to merge 1 commit into
mainfrom
NY-1394_atmns-editor-links

Conversation

@troyciesco

Copy link
Copy Markdown
Contributor

closes NY-1394

Problem

Selecting text and adding a link only showed a few recent posts — you couldn't type a URL or search, and typing overwrote the selected text. Koenig renders its link input in a portal on document.body, outside the shade ; Radix's modal focus trap pulled focus back into the editor, so keystrokes hit the selected text instead of the input.

Fix

Set modal={false} on the editor's to disable the focus trap, letting the portaled link input hold focus.

I verified things like cmd+S to save and clicking escape to close the editor (and show a warning if there's changes) still work properly

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

In EmailContentModal, the Dialog component prop modal={false} was added, switching the dialog from modal to non-modal behavior. The existing open state and onOpenChange handlers remain unchanged.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing link selection behavior in the automations email editor.
Description check ✅ Passed The description directly explains the bug and the modal={false} fix, matching the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch NY-1394_atmns-editor-links

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.

@nx-cloud

nx-cloud Bot commented Jun 29, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 39df48e

Command Status Duration Result
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 1s View ↗
nx run-many -t test:unit -p @tryghost/posts,@tr... ✅ Succeeded 2m 51s View ↗
nx run @tryghost/admin:build ✅ Succeeded 1m 48s View ↗
nx run-many -t lint -p @tryghost/posts,@tryghos... ✅ Succeeded 19s View ↗
nx run ghost:build:assets ✅ Succeeded 2s View ↗
nx run ghost:build:tsc ✅ Succeeded 6s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-29 17:17:31 UTC

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

Caution

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

⚠️ Outside diff range comments (1)
apps/posts/src/views/Automations/components/email-modal/email-content-modal.tsx (1)

253-257: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep this dialog modal

modal={false} relaxes focus trapping, so Tab can reach controls behind the editor without going through attemptClose(). Keep the dialog modal and fix the portal/input issue another way.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/posts/src/views/Automations/components/email-modal/email-content-modal.tsx`
around lines 253 - 257, The dialog in email-content-modal should remain modal;
setting Dialog to non-modal weakens focus trapping and lets Tab move to
background controls instead of staying within the modal flow. Remove the
non-modal behavior from the Dialog used by email-content-modal and address the
portal/input interaction in the editor another way, while preserving the
existing attemptClose handling in onOpenChange.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@apps/posts/src/views/Automations/components/email-modal/email-content-modal.tsx`:
- Around line 253-257: The dialog in email-content-modal should remain modal;
setting Dialog to non-modal weakens focus trapping and lets Tab move to
background controls instead of staying within the modal flow. Remove the
non-modal behavior from the Dialog used by email-content-modal and address the
portal/input interaction in the editor another way, while preserving the
existing attemptClose handling in onOpenChange.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f7e58292-ca9c-4f18-b484-1743d1e41b45

📥 Commits

Reviewing files that changed from the base of the PR and between a2ba9c1 and 39df48e.

📒 Files selected for processing (1)
  • apps/posts/src/views/Automations/components/email-modal/email-content-modal.tsx

@troyciesco troyciesco marked this pull request as draft June 29, 2026 17:57
@troyciesco

Copy link
Copy Markdown
Contributor Author

im gonna close this because the rabbit is right, this fix causes other issues with keyboard nav. i think the actual fix is in koenig.

@troyciesco troyciesco closed this Jun 29, 2026
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.

1 participant