Skip to content

Commit d6ff5ac

Browse files
committed
Add max height to version picker menu
1 parent d85b7d5 commit d6ff5ac

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

client/components/Dropdown/DropdownMenu.jsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ import { DropdownWrapper } from '../Dropdown';
88

99
const DropdownMenu = forwardRef(
1010
(
11-
{ children, anchor, 'aria-label': ariaLabel, align, className, classes },
11+
{
12+
children,
13+
anchor,
14+
'aria-label': ariaLabel,
15+
align,
16+
className,
17+
classes,
18+
maxHeight
19+
},
1220
ref
1321
) => {
1422
// Note: need to use a ref instead of a state to avoid stale closures.
@@ -32,7 +40,7 @@ const DropdownMenu = forwardRef(
3240
focusedRef.current = false;
3341
setTimeout(() => {
3442
if (!focusedRef.current) {
35-
close();
43+
// close();
3644
}
3745
}, 200);
3846
};
@@ -59,6 +67,7 @@ const DropdownMenu = forwardRef(
5967
}}
6068
onBlur={handleBlur}
6169
onFocus={handleFocus}
70+
style={maxHeight && { maxHeight, overflowY: 'auto' }}
6271
>
6372
{children}
6473
</DropdownWrapper>
@@ -84,14 +93,16 @@ DropdownMenu.propTypes = {
8493
classes: PropTypes.shape({
8594
button: PropTypes.string,
8695
list: PropTypes.string
87-
})
96+
}),
97+
maxHeight: PropTypes.string
8898
};
8999

90100
DropdownMenu.defaultProps = {
91101
anchor: null,
92102
align: 'right',
93103
className: '',
94-
classes: {}
104+
classes: {},
105+
maxHeight: undefined
95106
};
96107

97108
export default DropdownMenu;

client/modules/IDE/components/VersionPicker.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const VersionPicker = React.forwardRef(({ onChangeVersion }, ref) => {
4141
</span>
4242
}
4343
align="left"
44+
maxHeight="50vh"
4445
>
4546
{p5Versions.map((version) => (
4647
<MenuItem key={version} onClick={() => dispatchReplaceVersion(version)}>

0 commit comments

Comments
 (0)