Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(menu): solve the problem of display being cropped by not enabling sliding in popup mode #2057 #2129

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Menu = forwardRefWithStatics(
// 菜单宽度
const menuWidthArr = Array.isArray(width) ? width : [width, DEFAULT_MENU_WIDTH[1]];

const { collapsed } = value;
const { collapsed, expandType } = value;

return (
<MenuContext.Provider value={value}>
Expand All @@ -41,7 +41,13 @@ const Menu = forwardRefWithStatics(
>
<div className={`${classPrefix}-default-menu__inner`}>
{logo && <div className={`${classPrefix}-menu__logo`}>{logo}</div>}
<ul className={classNames(`${classPrefix}-menu`, { [`${classPrefix}-menu--scroll`]: !collapsed })}>
<ul
className={classNames(
`${classPrefix}-menu`,
{ [`${classPrefix}-menu--scroll`]: expandType !== 'popup' },
'narrow-scrollbar',
)}
>
{children}
</ul>
{operations && <div className={`${classPrefix}-menu__operations`}>{operations}</div>}
Expand Down
48 changes: 24 additions & 24 deletions test/snap/__snapshots__/csr.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -124167,7 +124167,7 @@ exports[`csr snapshot test > csr test src/layout/_example/aside.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -124265,7 +124265,7 @@ exports[`csr snapshot test > csr test src/layout/_example/aside.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -124916,7 +124916,7 @@ exports[`csr snapshot test > csr test src/layout/_example/combine.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active"
Expand Down Expand Up @@ -125321,7 +125321,7 @@ exports[`csr snapshot test > csr test src/layout/_example/combine.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active"
Expand Down Expand Up @@ -132315,7 +132315,7 @@ exports[`csr snapshot test > csr test src/menu/_example/closable-side.jsx 1`] =
</span>
</div>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -132693,7 +132693,7 @@ exports[`csr snapshot test > csr test src/menu/_example/closable-side.jsx 1`] =
</span>
</div>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -133793,7 +133793,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -133892,7 +133892,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -133994,7 +133994,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -134093,7 +134093,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -134893,7 +134893,7 @@ exports[`csr snapshot test > csr test src/menu/_example/group-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<div
class="t-menu-group"
Expand Down Expand Up @@ -135211,7 +135211,7 @@ exports[`csr snapshot test > csr test src/menu/_example/group-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<div
class="t-menu-group"
Expand Down Expand Up @@ -135585,7 +135585,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -135987,7 +135987,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -136346,7 +136346,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -136748,7 +136748,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -137955,7 +137955,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -138373,7 +138373,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -138739,7 +138739,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -139157,7 +139157,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -140250,7 +140250,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -140349,7 +140349,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -140451,7 +140451,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -140550,7 +140550,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down
Loading