Skip to content

Commit

Permalink
Merge pull request #6917 from Sage/submenu-max-width-fix
Browse files Browse the repository at this point in the history
fix(menu-item, submenu): remove min-width when submenuMaxWidth prop is set
  • Loading branch information
edleeks87 authored Aug 28, 2024
2 parents f8dd294 + 002c37d commit db66e46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/components/menu/__internal__/submenu/submenu.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const StyledSubmenu = styled.ul<StyledSubmenuProps>`
${submenuMaxWidth &&
css`
min-width: ${submenuMaxWidth};
max-width: ${submenuMaxWidth};
&&& {
Expand Down
1 change: 0 additions & 1 deletion src/components/menu/menu.pw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,6 @@ test(`should verify that submenu item text wraps when it would overflow the cont
);

await expect(submenuBlockElement).toHaveCSS("max-width", "300px");
await expect(lastItem).toHaveCSS("width", "300px");
expect(parseInt(cssItemHeight)).toBeGreaterThan(40);
});

Expand Down
13 changes: 12 additions & 1 deletion src/components/menu/menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,18 @@ export const TruncationAndSubmenuWidth: Story = () => {
submenuMaxWidth="300px"
submenu="This is a very long menu item title"
>
<MenuItem href="#">Item Submenu One</MenuItem>
<MenuItem href="#">Item One</MenuItem>
<MenuItem p="2px 16px">
<Box minWidth="268px">
<Search
placeholder="placeholder"
variant={
["white", "light"].includes(menuType) ? "default" : "dark"
}
defaultValue=""
/>
</Box>
</MenuItem>
<MenuSegmentTitle text="segment title that should wrap when it will overflow">
<MenuItem href="#">Item Two</MenuItem>
<MenuItem href="#">
Expand Down

0 comments on commit db66e46

Please sign in to comment.