Skip to content

Commit 8505f29

Browse files
Dariusz Niemczykdbkr
authored andcommitted
Fix invalid ContextualMenu positions
1 parent a5e2877 commit 8505f29

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/components/structures/ContextMenu.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,11 @@ export class ContextMenu extends React.PureComponent<IProps, IState> {
322322

323323
const menuClasses = classNames({
324324
'mx_ContextualMenu': true,
325-
'mx_ContextualMenu_left': !hasChevron && position.left,
326-
'mx_ContextualMenu_right': !hasChevron && position.right,
327-
'mx_ContextualMenu_top': !hasChevron && position.top,
328-
'mx_ContextualMenu_bottom': !hasChevron && position.bottom,
325+
// Defensively check for counter cases
326+
'mx_ContextualMenu_left': !hasChevron && position.left !== undefined && !position.right,
327+
'mx_ContextualMenu_right': !hasChevron && position.right !== undefined && !position.left,
328+
'mx_ContextualMenu_top': !hasChevron && position.top !== undefined && !position.bottom,
329+
'mx_ContextualMenu_bottom': !hasChevron && position.bottom !== undefined && !position.top,
329330
'mx_ContextualMenu_withChevron_left': chevronFace === ChevronFace.Left,
330331
'mx_ContextualMenu_withChevron_right': chevronFace === ChevronFace.Right,
331332
'mx_ContextualMenu_withChevron_top': chevronFace === ChevronFace.Top,

0 commit comments

Comments
 (0)