mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Prevent thread from being selected when thread menu is focused
This commit is contained in:
parent
7e396b1ac0
commit
c6a37b60b2
2 changed files with 19 additions and 4 deletions
|
|
@ -130,6 +130,13 @@ function ThreadItem({
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't select the thread when a menu is focused
|
||||
if (e.target instanceof HTMLElement &&
|
||||
(e.target.hasAttribute('aria-haspopup') || e.target.role === 'menuitem')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.altKey) {
|
||||
const hasUnreads = thread ? Boolean(thread.unread_replies) : false;
|
||||
const lastViewedAt = hasUnreads ? Date.now() : unreadTimestamp;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,9 @@ function ThreadMenu({
|
|||
/>
|
||||
</>)
|
||||
}
|
||||
onClick={useCallback(() => {
|
||||
onClick={useCallback((e: React.MouseEvent | React.KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
|
||||
dispatch(setThreadFollow(currentUserId, currentTeamId, threadId, !isFollowing));
|
||||
readAloud(isFollowing ? formatMessage({
|
||||
id: 'threading.threadMenu.unfollowed',
|
||||
|
|
@ -144,7 +146,9 @@ function ThreadMenu({
|
|||
defaultMessage='Open in channel'
|
||||
/>
|
||||
}
|
||||
onClick={useCallback(() => {
|
||||
onClick={useCallback((e: React.MouseEvent | React.KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
|
||||
goToInChannel(threadId);
|
||||
readAloud(formatMessage({
|
||||
id: 'threading.threadMenu.openingChannel',
|
||||
|
|
@ -178,7 +182,9 @@ function ThreadMenu({
|
|||
defaultMessage='Save'
|
||||
/>
|
||||
)}
|
||||
onClick={useCallback(() => {
|
||||
onClick={useCallback((e: React.MouseEvent | React.KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
|
||||
dispatch(isSaved ? unsavePost(threadId) : savePost(threadId));
|
||||
readAloud(isSaved ? formatMessage({
|
||||
id: 'threading.threadMenu.unsaved',
|
||||
|
|
@ -196,7 +202,9 @@ function ThreadMenu({
|
|||
defaultMessage='Copy link'
|
||||
/>
|
||||
}
|
||||
onClick={useCallback(() => {
|
||||
onClick={useCallback((e: React.MouseEvent | React.KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
|
||||
copyToClipboard(`${getSiteURL()}/${team}/pl/${threadId}`);
|
||||
readAloud(formatMessage({
|
||||
id: 'threading.threadMenu.linkCopied',
|
||||
|
|
|
|||
Loading…
Reference in a new issue