Disable context menu inside notifications popover
Popovers over popovers ain't easy
This commit is contained in:
parent
86a362c619
commit
4c7c518d4d
|
@ -67,7 +67,12 @@ const contentText = {
|
|||
|
||||
const AVATARS_LIMIT = 50;
|
||||
|
||||
function Notification({ notification, instance, isStatic }) {
|
||||
function Notification({
|
||||
notification,
|
||||
instance,
|
||||
isStatic,
|
||||
disableContextMenu,
|
||||
}) {
|
||||
const { id, status, account, report, _accounts, _statuses } = notification;
|
||||
let { type } = notification;
|
||||
|
||||
|
@ -300,20 +305,24 @@ function Notification({ notification, instance, isStatic }) {
|
|||
? `/${instance}/s/${actualStatusID}`
|
||||
: `/s/${actualStatusID}`
|
||||
}
|
||||
onContextMenu={(e) => {
|
||||
const post = e.target.querySelector('.status');
|
||||
if (post) {
|
||||
// Fire a custom event to open the context menu
|
||||
if (e.metaKey) return;
|
||||
e.preventDefault();
|
||||
post.dispatchEvent(
|
||||
new MouseEvent('contextmenu', {
|
||||
clientX: e.clientX,
|
||||
clientY: e.clientY,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}}
|
||||
onContextMenu={
|
||||
!disableContextMenu
|
||||
? (e) => {
|
||||
const post = e.target.querySelector('.status');
|
||||
if (post) {
|
||||
// Fire a custom event to open the context menu
|
||||
if (e.metaKey) return;
|
||||
e.preventDefault();
|
||||
post.dispatchEvent(
|
||||
new MouseEvent('contextmenu', {
|
||||
clientX: e.clientX,
|
||||
clientY: e.clientY,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{isStatic ? (
|
||||
<Status status={actualStatus} size="s" />
|
||||
|
|
|
@ -179,6 +179,7 @@ function NotificationsMenu({ anchorRef, state, onClose }) {
|
|||
key={notification.id}
|
||||
instance={instance}
|
||||
notification={notification}
|
||||
disableContextMenu
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
|
|
Loading…
Reference in a new issue