Skip to content

fix(VM) context menu position for VMs.#2642

Open
SimonFair wants to merge 1 commit into
unraid:masterfrom
SimonFair:fix/eng-xx-fix-context-menu-display-issue
Open

fix(VM) context menu position for VMs.#2642
SimonFair wants to merge 1 commit into
unraid:masterfrom
SimonFair:fix/eng-xx-fix-context-menu-display-issue

Conversation

@SimonFair
Copy link
Copy Markdown
Contributor

@SimonFair SimonFair commented May 18, 2026

When selecting a VM to get the context menu if the the icon was at the bottom of the page then the menu would not fully show on the screen with some of the content showing off the page.

This change moves the location of the context menu to be above if close to bottom.

image

Summary by CodeRabbit

  • Bug Fixes
    • Improved context menu positioning for virtual machine and snapshot options to remain properly visible within the viewport during user interactions.

Review Change Stack

OS-220

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Walkthrough

This PR fixes viewport-clamping issues for VM and snapshot context menus. New helper functions adjust dropdown positioning to stay within the viewport, set z-index/overflow CSS, ensure a DOM spacer element, and rebind event handlers. The VM and snapshot context menus switch from fixed above:false to above:'auto' positioning and apply these fixes after menu attachment.

Changes

Context Menu Viewport Positioning

Layer / File(s) Summary
Dropdown positioning helper functions
emhttp/plugins/dynamix.vm.manager/javascript/vmmanager.js
clampVMContextDropdownToViewport() clamps the dropdown top position within viewport bounds, and applyVMContextDropdownFix() manages CSS properties (z-index, max-height, overflow), ensures a spacer <li> element exists, and binds/unbinds namespaced event handlers to re-apply the fix after user interactions.
VM context menu positioning
emhttp/plugins/dynamix.vm.manager/javascript/vmmanager.js
Context menu setting changes from above:false to above:'auto', and the dropdown fix is applied after menu attachment with conditional selector logic for usage and regular VM menu elements.
Snapshot context menu positioning
emhttp/plugins/dynamix.vm.manager/javascript/vmmanager.js
Context menu setting changes from above:false to above:'auto', and the dropdown fix is applied after snapshot menu attachment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A dropdown that dances within the viewport's embrace,
No longer escaping beyond sight or space,
With spacers and handlers all bound in their place,
The context menus now show proper grace!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing context menu positioning for VMs. It is concise, specific, and directly reflects the primary objective of preventing off-screen menu rendering.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.05.18.0733
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2642/webgui-pr-2642.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix.vm.manager/javascript/vmmanager.js

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2642, or run:

plugin remove webgui-pr-2642

🤖 This comment is automatically generated and will be updated with each new push to this PR.

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