🐛 Fixed link selection in automations email editor#28967
Conversation
WalkthroughIn 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
| 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
There was a problem hiding this comment.
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 winKeep this dialog modal
modal={false}relaxes focus trapping, so Tab can reach controls behind the editor without going throughattemptClose(). 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
📒 Files selected for processing (1)
apps/posts/src/views/Automations/components/email-modal/email-content-modal.tsx
|
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. |

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