ensure contextMenu doesn't overflow viewport (#364)

This commit is contained in:
David Luzar 2020-01-14 09:44:18 +01:00 committed by Faustino Kialungila
parent d2a3ed7931
commit 8104c8525d
2 changed files with 35 additions and 4 deletions

View file

@ -18,7 +18,12 @@ type Props = {
function ContextMenu({ options, onCloseRequest, top, left }: Props) {
return (
<Popover onCloseRequest={onCloseRequest} top={top} left={left}>
<Popover
onCloseRequest={onCloseRequest}
top={top}
left={left}
fitInViewport={true}
>
<ul className="context-menu" onContextMenu={e => e.preventDefault()}>
{options.map((option, idx) => (
<li