Skip to content

Commit d081d3a

Browse files
authored
Merge pull request matrix-org#6801 from matrix-org/dbkr/19012_rel_2
Fix emoji picker and stickerpicker not appearing correctly when opened
2 parents a5e2877 + 769c9cd commit d081d3a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/components/structures/ContextMenu.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)