Fix command menu list item overflow (#10544)

Before:
<img width="501" alt="Capture d’écran 2025-02-27 à 12 10 52"
src="https://github.com/user-attachments/assets/dd3637b4-cfe4-44b9-8db2-78e14741a415"
/>

After:
<img width="503" alt="Capture d’écran 2025-02-27 à 12 10 40"
src="https://github.com/user-attachments/assets/71ebb02d-cdc8-44e6-82dd-d00b3a45e7c0"
/>
This commit is contained in:
Raphaël Bosi
2025-02-27 12:38:30 +01:00
committed by GitHub
parent d9e6b95c04
commit fb38828943

View File

@ -6,7 +6,7 @@ import {
StyledMenuItemLeftContent,
} from '../internals/components/StyledMenuItemBase';
import { IconComponent } from '@ui/display';
import { IconComponent, OverflowingTextWithTooltip } from '@ui/display';
import { useIsMobile } from '@ui/utilities/responsive/hooks/useIsMobile';
import { ReactNode } from 'react';
import { MenuItemCommandHotKeys } from './MenuItemCommandHotKeys';
@ -75,6 +75,7 @@ const StyledDescription = styled.span`
const StyledTextContainer = styled.div`
display: flex;
flex-direction: row;
max-width: calc(100% - 2 * var(--horizontal-padding));
`;
export type MenuItemCommandProps = {
@ -114,7 +115,9 @@ export const MenuItemCommand = ({
</StyledBigIconContainer>
)}
<StyledTextContainer>
<StyledMenuItemLabelText>{text}</StyledMenuItemLabelText>
<StyledMenuItemLabelText>
<OverflowingTextWithTooltip text={text} />
</StyledMenuItemLabelText>
{description && <StyledDescription>{description}</StyledDescription>}
</StyledTextContainer>
{RightComponent}