-
Notifications
You must be signed in to change notification settings - Fork 374
Add compact menu style for smaller window heights #5323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🎭 Playwright Test Results✅ All tests passed across all browsers! ⏰ Completed at: 09/04/2025, 07:01:15 PM UTC 📊 Test Reports by Browser🎉 Your tests are passing across all browsers! |
I don't like that the submenu doesn't align at all with the menu trigger here The demo menus here adapt if they're too close to the edge. Are we doing something special that's overriding that behavior? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I think the approach more aligned with the codebase would be to useBreakpoints
-- and we can expect that the breakpoints will generally give us a correct idea about the height. Alternatively, we can just handle the edge case by making the menu scrollable and fill-available
css properties. However, I think this solution is also fine.
I agree but I think this issue was existing before this PR right? |
An earlier version of this PR had a video that had the help menu floating at the very top. |
In my own testing of this, the issue is mitigated by removing the |
Tested and it solves the problem. |
This pull request enhances the responsiveness of the `CommandMenubar` component by introducing a "compact" mode for screens with limited vertical space. When the window height is less than 700px, the menubar adapts its submenu positioning and styling to improve usability on smaller displays. The most important changes are grouped below: **Responsive Behavior and State Management:** * Added a reactive `windowHeight` reference and a computed `isCompactHeight` property to detect when the window height is below 700px, enabling "compact" mode for the menubar. Event listeners for window resize are now managed using `onMounted` and `onUnmounted` lifecycle hooks to keep the state updated. [[1]](diffhunk://#diff-10ee0e60e600a168bdd45e0b9f05a148f5b9ee48f54e6c7dee737ebe7b6192e6R314-R326) [[2]](diffhunk://#diff-10ee0e60e600a168bdd45e0b9f05a148f5b9ee48f54e6c7dee737ebe7b6192e6L103-R104) **Dynamic Styling and Class Application:** * Updated the root element's class bindings to apply the `comfy-command-menu-compact` class when `isCompactHeight` is true, enabling conditional styling for compact mode. **Compact Mode Styling:** * Introduced new CSS rules for `.comfy-command-menu-compact` to force submenus to open to the right and align with the top of the menu container, ensuring better usability on short screens. Adjustments include submenu positioning, alignment for nested menus, and ensuring the submenu container uses the full available height. * /fix #5289 https://github.com/user-attachments/assets/e7908b57-3f07-4fc4-a119-66f2b7e398c5 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5323-Add-compact-menu-style-for-smaller-window-heights-2636d73d3650816cb5aaf4ac76c39739) by [Unito](https://www.unito.io)
This pull request enhances the responsiveness of the
CommandMenubar
component by introducing a "compact" mode for screens with limited vertical space. When the window height is less than 700px, the menubar adapts its submenu positioning and styling to improve usability on smaller displays. The most important changes are grouped below:Responsive Behavior and State Management:
windowHeight
reference and a computedisCompactHeight
property to detect when the window height is below 700px, enabling "compact" mode for the menubar. Event listeners for window resize are now managed usingonMounted
andonUnmounted
lifecycle hooks to keep the state updated. [1] [2]Dynamic Styling and Class Application:
comfy-command-menu-compact
class whenisCompactHeight
is true, enabling conditional styling for compact mode.Compact Mode Styling:
.comfy-command-menu-compact
to force submenus to open to the right and align with the top of the menu container, ensuring better usability on short screens. Adjustments include submenu positioning, alignment for nested menus, and ensuring the submenu container uses the full available height./fix #5289
Screen.Recording.2025-09-04.at.04.51.59.mov
┆Issue is synchronized with this Notion page by Unito