Skip to content

Commit 769c9cd

Browse files
Dariusz Niemczykdbkr
authored andcommitted
Add a better comment describing the behavior
1 parent 8505f29 commit 769c9cd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/structures/ContextMenu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ export class ContextMenu extends React.PureComponent<IProps, IState> {
322322

323323
const menuClasses = classNames({
324324
'mx_ContextualMenu': true,
325-
// Defensively check for counter cases
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+
*/
326331
'mx_ContextualMenu_left': !hasChevron && position.left !== undefined && !position.right,
327332
'mx_ContextualMenu_right': !hasChevron && position.right !== undefined && !position.left,
328333
'mx_ContextualMenu_top': !hasChevron && position.top !== undefined && !position.bottom,

0 commit comments

Comments
 (0)