fix: bubbling events from html message iframe#13321
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
📝 WalkthroughWalkthrough
ChangesMessage event forwarding
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a63139d1-b61f-41da-9101-34546152271a
📒 Files selected for processing (1)
src/components/MessageHTMLBody.vue
Signed-off-by: Roberto Guido <info@madbob.org>
Issue: events occurring into the iframe rendering contents of an HTML message are absorbed by the iframe itself, and cannot be intercepted by the application. This breaks many frontend's behaviours once the user interact with the iframe itself (e.g. keyboard shortcuts do not work anymore once the user clicks on the message contents, and action menus do not close when incidentally clicking over the iframe).
With this change, some type of events are intercepted and replicated to the local DOM to be properly handled.
In details:
keyupandkeydownare consumed byvue-shortkeyto handle keyboard shortcutsclickis consumed by byNcActionsto evaluate closing action menus (this specific change was already submitted in fix: actions menu for envelope #13296 but reverted to isolate and better evaluate this whole proposal)Security implications: my understanding is that Mail strips Javascript from HTML of incoming messages. Which is, indeed, a sane practice applied by most web email clients. So, the risk of JS forged events escaping from the iframe is mitigated at his very root. A confirmation for this would be appreciated.
Fixes #6804
Summary by CodeRabbit