Prevent links from opening twice in read-only mode#9404
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe custom link click handler resolves contained anchors, blocks dangerous URI schemes, prevents opening in non-editable views, and opens safe links only in editable views. ChangesCustom link click handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Pull request overview
Fixes duplicate tabs opening when clicking links in read-only rendered editor content by avoiding the custom window.open() click handling in non-editable ProseMirror views.
Changes:
- Added an early return in the custom-link ProseMirror click handler when
view.editableis false to let native anchor navigation handle read-only clicks.
a18f728 to
de2c79f
Compare
de2c79f to
295c843
Compare
Description
Fixes duplicate tabs opening when left-clicking links in read-only comments and work-item descriptions.
The custom link click handler previously called
window.open()even when the editor was read-only. In that mode, the browser also followed the rendered anchor's native navigation, causing the same link to open twice. The handler now returns early for non-editable views, allowing the browser to handle read-only links natively while preserving the existing programmatic behavior in editable views.Type of Change
Screenshots and Media (if applicable)
Not applicable.
Test Scenarios
window.open()when the editor is read-only, leaving navigation to the native anchor behavior.References
Fixes #9386
Summary by CodeRabbit
javascript:,data:,vbscript:,file:, orabout:) to reduce the risk of unintended actions.