fix: No reserved space for submenu arrow
fix: Submenu arrow miss-positioned when menu is scrollable closes #3191
This commit is contained in:
@@ -93,11 +93,14 @@ const Spacer = styled.svg`
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const MenuAnchorCSS = css<{
|
type MenuAnchorProps = {
|
||||||
level?: number;
|
level?: number;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
dangerous?: boolean;
|
dangerous?: boolean;
|
||||||
}>`
|
disclosure?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MenuAnchorCSS = css<MenuAnchorProps>`
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
@@ -114,6 +117,7 @@ export const MenuAnchorCSS = css<{
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
svg:not(:last-child) {
|
svg:not(:last-child) {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
@@ -145,6 +149,8 @@ export const MenuAnchorCSS = css<{
|
|||||||
|
|
||||||
${breakpoint("tablet")`
|
${breakpoint("tablet")`
|
||||||
padding: 4px 12px;
|
padding: 4px 12px;
|
||||||
|
padding-right: ${(props: MenuAnchorProps) =>
|
||||||
|
props.disclosure ? 32 : 12}px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
`};
|
`};
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ const Submenu = React.forwardRef(
|
|||||||
<>
|
<>
|
||||||
<MenuButton ref={ref} {...menu} {...rest}>
|
<MenuButton ref={ref} {...menu} {...rest}>
|
||||||
{(props) => (
|
{(props) => (
|
||||||
<MenuAnchor {...props}>
|
<MenuAnchor disclosure {...props}>
|
||||||
{title} <Disclosure color={theme.textTertiary} />
|
{title} <Disclosure color={theme.textTertiary} />
|
||||||
</MenuAnchor>
|
</MenuAnchor>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user