Skip to content

Commit

Permalink
fix(submenu): ensure submenu has expected width in Safari
Browse files Browse the repository at this point in the history
Fixes issue where a MenuItem within a submenu with overflow would get cut off and render with a
scroll bar.

fix #7112
  • Loading branch information
nuria1110 committed Dec 16, 2024
1 parent d1a7d79 commit 6270f5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/menu/__internal__/submenu/submenu.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const StyledSubmenuWrapper = styled.div<StyledSubmenuWrapperProps>`
${!inFullscreenView &&
css`
display: flex;
flex-direction: column;
`}
`}
`;
Expand Down Expand Up @@ -88,6 +89,7 @@ const StyledSubmenu = styled.ul<StyledSubmenuProps>`
${submenuMaxWidth &&
css`
width: max-content;
max-width: ${submenuMaxWidth};
&&& {
Expand Down
6 changes: 6 additions & 0 deletions src/components/menu/menu-test.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ export const LongLabelsStory = () => {
<MenuItem>Child B</MenuItem>
<MenuItem>Child C</MenuItem>
</MenuItem>
<MenuItem submenu="Parent Menu C with overflow" submenuMaxWidth="350px">
<MenuItem width="unset" minWidth="max-content" maxWidth="300px">
Child with a very long label that should wrap onto the next line and
not get cut off
</MenuItem>
</MenuItem>
</Menu>
);
};
Expand Down

0 comments on commit 6270f5d

Please sign in to comment.