Repository navigation
fix: reset menu-bar-item attributes to initial state when returned to the menu bar - #5610
Merged
web-padawan merged 4 commits intoFeb 28, 2023
Merged
Conversation
…rned from "overflow" sub-menu back to the menu bar
…storing the button to rollback to the exact initial state of the item
web-padawan
reviewed
Feb 28, 2023
web-padawan
left a comment
Member
There was a problem hiding this comment.
The actual fix looks good to me. Consider adding unit tests instead of snapshot tests though.
We mostly use snapshot tests to cover granular states e.g. disabled, readonly and such.
This definitely needs to be clarified in our development guide and onboarding materials.
As a rule of thumb, when fixing a bug, let's add a test that fails if you revert the code change.
bwajtr
commented
Feb 28, 2023
vursen
reviewed
Feb 28, 2023
…m snapshot test to unit test
bwajtr
marked this pull request as ready for review
February 28, 2023 09:49
web-padawan
reviewed
Feb 28, 2023
web-padawan
left a comment
Member
There was a problem hiding this comment.
Overall LGTM, just a few small suggestions on improving tests.
|
Kudos, SonarCloud Quality Gate passed!
|
web-padawan
deleted the
4692-menubar-item-content-is-clipped-on-resize
branch
February 28, 2023 12:25
vaadin-bot
pushed a commit
that referenced
this pull request
Feb 28, 2023
web-padawan
added a commit
that referenced
this pull request
Feb 28, 2023
bwajtr
added a commit
that referenced
this pull request
Feb 28, 2023
bwajtr
added a commit
that referenced
this pull request
Feb 28, 2023
… (CP: 23.3) (#5618) --------- Co-authored-by: Bretislav Wajtr <bretislav@vaadin.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Description
Note that even though the original issue says that the issue is reproducible only with flow, it's not so. It's purely a web-component problem and can be reproduced without flow by using the "component" property when defining menu items:
The reason why the menu items with submenus are clipped after the steps described in vaadin/flow-components#4692 is, that the given items show the "angle right" symbol to the right of them. Here I mangled with the paddings to reveal the "angle right" symbol:

The angle symbol is displayed because of the rule defined at vaadin-context-menu-item-styles.js:13
Why this happens
As mentioned above, when you define menu items with the "component" property, then the "component" is wrapped with
vaadin-menu-bar-itembefore it's placed insidevaadin-menu-bar-button. Initially, thisvaadin-menu-bar-itemhas the following attributes:This item has only
aria-selectedattribute and the attributes do not change even when you click on it, hide it and reveal it by resizing the menu bar etc.The problem is that when you do the steps described in vaadin/flow-components#4692, then the
vaadin-menu-bar-itemis reused and is moved to the context menu. When it's moved there, it gets bunch of additional attributes:... and these attributes are not removed when the item is moved back to the menu bar, under
vaadin-menu-bar-button. One of the isaria-haspopup="true", which then causes the above CSS rule to kick in and the angle right is displayed.Why it was not reproducible in Vaadin 23
In Vaadin 23, the menu bar's structure was different and composed of
vaadin-context-menu-item. In Vaadin 24 it was replaced byvaadin-menu-bar-itemand also the CSS rule for angle right specification was different. In Vaadin 23 the angle right was displayed only when.vaadin-menu-itemCSS class was present on the menu item. This CSS class was added to the item when moved to the context menu and then removed from the item when it was moved back to thevaadin-menu-bar-buttonFixes vaadin/flow-components#4692
Type of change
Checklist