From 137c6f8a758c0b9fbbe8726b31048585887e6dbb Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:56:43 +0530 Subject: [PATCH] fix: Context menu and its submenu boundary overflow (#10729) # Pull Request Template ## Description This PR adds smart positioning to prevent context menu and submenu from overflowing screen boundaries. The context menu and its submenu now dynamically adjust their position when there isn't enough space. Fixes https://linear.app/chatwoot/issue/CW-3936/assign-to-agent-ui-element-is-drawn-off-canvas https://github.com/chatwoot/chatwoot/issues/10727 ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? **Loom video** **Before** https://www.loom.com/share/6c267dde103c4f2281ed5b4d006a43b1?sid=047966f5-d6d3-4de6-ade8-270141e6e215 **After** https://www.loom.com/share/5599c6061bb74c3ea527dd06960d3189?sid=ffb01149-bb7a-449e-b0ec-02cc191f472b ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../dashboard/components/ui/ContextMenu.vue | 61 ++++++++++++++----- .../contextMenu/menuItemWithSubmenu.vue | 52 ++++++++++++---- 2 files changed, 86 insertions(+), 27 deletions(-) diff --git a/app/javascript/dashboard/components/ui/ContextMenu.vue b/app/javascript/dashboard/components/ui/ContextMenu.vue index 48fa7acf1..8b77ce254 100644 --- a/app/javascript/dashboard/components/ui/ContextMenu.vue +++ b/app/javascript/dashboard/components/ui/ContextMenu.vue @@ -1,34 +1,67 @@