@@ -322,10 +322,16 @@ 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+ /**
326+ * In some cases we may get the number of 0, which still means that we're supposed to properly
327+ * add the specific position class, but as it was falsy things didn't work as intended.
328+ * In addition, defensively check for counter cases where we may get more than one value,
329+ * even if we shouldn't.
330+ */
331+ 'mx_ContextualMenu_left' : ! hasChevron && position . left !== undefined && ! position . right ,
332+ 'mx_ContextualMenu_right' : ! hasChevron && position . right !== undefined && ! position . left ,
333+ 'mx_ContextualMenu_top' : ! hasChevron && position . top !== undefined && ! position . bottom ,
334+ 'mx_ContextualMenu_bottom' : ! hasChevron && position . bottom !== undefined && ! position . top ,
329335 'mx_ContextualMenu_withChevron_left' : chevronFace === ChevronFace . Left ,
330336 'mx_ContextualMenu_withChevron_right' : chevronFace === ChevronFace . Right ,
331337 'mx_ContextualMenu_withChevron_top' : chevronFace === ChevronFace . Top ,
0 commit comments