Skip to content

Commit c777721

Browse files
author
Luke Bowerman
authored
fix: Correct List overflow & Tree color typing (#2337)
Conditionally add overflow: auto if windowing is enabled
1 parent 19d2665 commit c777721

File tree

8 files changed

+6
-5
lines changed

8 files changed

+6
-5
lines changed

packages/components/src/List/List.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ describe('List', () => {
8686
expect(screen.getByTestId('after')).toHaveStyle(`height: ${height}px;`)
8787
})
8888

89-
test('no height: 100% without windowing', () => {
89+
test('no "overflow: auto" without windowing', () => {
9090
renderWithTheme(<Basic />)
9191

92-
expect(screen.getByRole('list')).not.toHaveStyle('height: 100%')
92+
expect(screen.getByRole('list')).not.toHaveStyle('overflow: auto')
9393
})
9494
})
9595
describe('color', () => {

packages/components/src/List/List.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export const ListInternal = forwardRef(
153153
tabIndex={-1}
154154
role={role || 'list'}
155155
height={height}
156+
windowing={windowing}
156157
{...props}
157158
{...navProps}
158159
>
@@ -174,7 +175,7 @@ const ListStyle = styled.ul
174175
175176
list-style: none;
176177
margin: 0;
177-
overflow: auto;
178+
${({ windowing }) => windowing !== 'none' && 'overflow: auto;'}
178179
padding: 0;
179180
`
180181

packages/components/src/Tree/Tree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,4 @@ const TreeLayout: FC<TreeProps> = ({
194194
)
195195
}
196196

197-
export const Tree = styled(TreeLayout)<TreeProps>``
197+
export const Tree = styled(TreeLayout)``

packages/components/src/Tree/TreeItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ const TreeItemLayout: FC<TreeItemProps> = ({
8181
)
8282
}
8383

84-
export const TreeItem = styled(TreeItemLayout)<TreeItemProps>``
84+
export const TreeItem = styled(TreeItemLayout)``
-120 Bytes
Loading

snapshots/MenuList/Basic-snap.png

-179 Bytes
Loading
-118 Bytes
Loading
-118 Bytes
Loading

0 commit comments

Comments
 (0)