Skip to content

Commit fba459b

Browse files
fix: do not expand to full available width (#3506) (#3507)
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
1 parent 345dab7 commit fba459b

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/menu-bar/src/vaadin-menu-bar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class MenuBar extends ButtonsMixin(InteractionsMixin(ElementMixin(ThemableMixin(
6464
<style>
6565
:host {
6666
display: block;
67-
width: 100%; /* make overflow work in flex */
67+
align-self: stretch; /* make overflow work in flex */
6868
}
6969
7070
:host([hidden]) {

packages/menu-bar/test/menu-bar.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,3 +570,22 @@ describe('item components', () => {
570570
expect(Number(style.zIndex)).to.equal(1);
571571
});
572572
});
573+
574+
describe('menu-bar in flex', () => {
575+
let wrapper;
576+
let menu;
577+
578+
beforeEach(() => {
579+
wrapper = fixtureSync(`
580+
<div style="display: flex; width: 400px;">
581+
<vaadin-menu-bar></vaadin-menu-bar>
582+
</div>
583+
`);
584+
menu = wrapper.firstElementChild;
585+
menu.items = [{ text: 'Item 1' }, { text: 'Item 2' }, { text: 'Item 3' }];
586+
});
587+
588+
it('should not expand to full width of the container', () => {
589+
expect(menu.offsetWidth).to.be.lessThan(wrapper.offsetWidth);
590+
});
591+
});

0 commit comments

Comments
 (0)