From d54a8713d1dff0a725307fe6b2f2bf72abeef391 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 27 Dec 2020 10:49:33 -0800 Subject: [PATCH] Fix width of dropdown menus --- resources/scripts/components/elements/DropdownMenu.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/scripts/components/elements/DropdownMenu.tsx b/resources/scripts/components/elements/DropdownMenu.tsx index eb9701004..81b397487 100644 --- a/resources/scripts/components/elements/DropdownMenu.tsx +++ b/resources/scripts/components/elements/DropdownMenu.tsx @@ -40,9 +40,7 @@ class DropdownMenu extends React.PureComponent { if (this.state.visible && !prevState.visible && menu) { document.addEventListener('click', this.windowListener); document.addEventListener('contextmenu', this.contextMenuListener); - menu.setAttribute( - 'style', `left: ${Math.round(this.state.posX - menu.clientWidth)}px`, - ); + menu.style.left = `${Math.round(this.state.posX - menu.clientWidth)}px`; } if (!this.state.visible && prevState.visible) { @@ -94,6 +92,7 @@ class DropdownMenu extends React.PureComponent { e.stopPropagation(); this.setState({ visible: false }); }} + style={{ width: '12rem' }} css={tw`absolute bg-white p-2 rounded border border-neutral-700 shadow-lg text-neutral-500 z-50`} > {this.props.children}