Skip to content

Commit

Permalink
Fix Select menu cropping in create item drawer (#4204)
Browse files Browse the repository at this point in the history
* Fix Select menu cropping in create item drawer

* Add changeset
  • Loading branch information
JedWatson committed Nov 11, 2020
1 parent ba9906a commit 5216e9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/gold-poets-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@keystonejs/fields": patch
"@keystone-ui/fields": patch
---

Fix Select menu cropping in create item drawer
4 changes: 4 additions & 0 deletions design-system/packages/fields/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const useStyles = ({
boxShadow: '0 4px 11px hsla(0, 0%, 0%, 0.1)',
borderRadius: tokens.borderRadius,
}),
menuPortal: (provided: any) => ({ ...provided, zIndex: 9999 }),
multiValue: (provided: any) => ({
...provided,
backgroundColor: palette.neutral300,
Expand Down Expand Up @@ -121,6 +122,8 @@ export function Select({
const tokens = useInputTokens({ width: widthKey });
const styles = useStyles({ tokens });

const portalTarget = typeof document !== 'undefined' ? document.body : undefined;

return (
<ReactSelect
value={value}
Expand All @@ -135,6 +138,7 @@ export function Select({
}}
{...props}
isMulti={false}
menuPortalTarget={portalTarget}
/>
);
}
Expand Down

0 comments on commit 5216e9d

Please sign in to comment.