Make triple dot menu work on really small screen widths

This commit is contained in:
Josh Perez 2021-10-05 09:58:34 -04:00 committed by GitHub
parent 48aaf9e4f3
commit 87ea95735e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 17 deletions

View File

@ -262,6 +262,21 @@
);
}
}
&--container {
border-radius: 4px;
height: 24px;
// the z-index here is so that this container is above the message and when
// clicked on, doesn't propagate the click event to the message.
z-index: 2;
@include light-theme {
background-color: $color-white;
}
@include dark-theme {
background-color: $color-gray-95;
}
}
}
.module-message__buttons__menu--incoming {

View File

@ -6,10 +6,14 @@ import React, { ReactNode } from 'react';
// Whenever you don't want click events to propagate into their parent container
export const StopPropagation = ({
children,
className,
}: {
children: ReactNode;
className?: string;
}): JSX.Element => (
// eslint-disable-next-line max-len
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
<div onClick={ev => ev.stopPropagation()}>{children}</div>
<div className={className} onClick={ev => ev.stopPropagation()}>
{children}
</div>
);

View File

@ -1407,22 +1407,24 @@ export class Message extends React.PureComponent<Props, State> {
const maybePopperRef = !isWide ? popperRef : undefined;
return (
<ContextMenuTrigger
id={triggerId}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ref={this.captureMenuTrigger as any}
>
<div
ref={maybePopperRef}
role="button"
onClick={this.showMenu}
aria-label={i18n('messageContextMenuButton')}
className={classNames(
'module-message__buttons__menu',
`module-message__buttons__download--${direction}`
)}
/>
</ContextMenuTrigger>
<StopPropagation className="module-message__buttons__menu--container">
<ContextMenuTrigger
id={triggerId}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ref={this.captureMenuTrigger as any}
>
<div
ref={maybePopperRef}
role="button"
onClick={this.showMenu}
aria-label={i18n('messageContextMenuButton')}
className={classNames(
'module-message__buttons__menu',
`module-message__buttons__download--${direction}`
)}
/>
</ContextMenuTrigger>
</StopPropagation>
);
}}
</Reference>