diff --git a/e2e-tests/playwright/tests/accessibility/channels/intro_channel.spec.ts b/e2e-tests/playwright/tests/accessibility/channels/intro_channel.spec.ts index 57eda52431..6b0cdff2bb 100644 --- a/e2e-tests/playwright/tests/accessibility/channels/intro_channel.spec.ts +++ b/e2e-tests/playwright/tests/accessibility/channels/intro_channel.spec.ts @@ -129,12 +129,10 @@ test('Post actions tab support', async ({pw, axe}) => { // # Press arrow right await channelsPage.postDotMenu.remindMenuItem.press('ArrowRight'); - // * Reminder menu should be visible and have focused - channelsPage.postReminderMenu.toBeVisible(); - await expect(channelsPage.postReminderMenu.container).toBeFocused(); + // * Reminder menu should be visible + expect(channelsPage.postReminderMenu.container).toBeVisible(); - // * Should move focus to 30 mins after arrow down - await channelsPage.postReminderMenu.container.press('ArrowDown'); + // * Should have focus on 30 mins after submenu opens expect(await channelsPage.postReminderMenu.thirtyMinsMenuItem).toBeFocused(); // * Should move focus to 1 hour after arrow down diff --git a/webapp/channels/src/components/dot_menu/post_reminder_submenu.tsx b/webapp/channels/src/components/dot_menu/post_reminder_submenu.tsx index 6eb08fc94e..634dfcc2a7 100644 --- a/webapp/channels/src/components/dot_menu/post_reminder_submenu.tsx +++ b/webapp/channels/src/components/dot_menu/post_reminder_submenu.tsx @@ -159,13 +159,16 @@ function PostReminderSubmenu(props: Props) { leadingElement={} trailingElements={} menuId={`remind_post_${props.post.id}-menu`} + subMenuHeader={ +
+ {formatMessage( + { + id: 'post_info.post_reminder.sub_menu.header', + defaultMessage: 'Set a reminder for:', + }, + )} +
} > -
- {formatMessage( - {id: 'post_info.post_reminder.sub_menu.header', - defaultMessage: 'Set a reminder for:'}, - )} -
{postReminderSubMenuItems} ); diff --git a/webapp/channels/src/components/menu/menu.scss b/webapp/channels/src/components/menu/menu.scss index f8934f0236..53de423019 100644 --- a/webapp/channels/src/components/menu/menu.scss +++ b/webapp/channels/src/components/menu/menu.scss @@ -7,12 +7,13 @@ min-width: 114px; max-width: 496px; max-height: 80vh; + padding: 4px 0; background-color: var(--center-channel-bg); - box-shadow: var(--elevation-4); + box-shadow: var(--elevation-4), 0 0 0 1px rgba(var(--center-channel-color-rgb), 0.12) inset; } &.AsSubMenu { & .MuiPaper-root { - box-shadow: var(--elevation-5); + box-shadow: var(--elevation-5), 0 0 0 1px rgba(var(--center-channel-color-rgb), 0.12) inset; } } } diff --git a/webapp/channels/src/components/menu/menu.test.tsx b/webapp/channels/src/components/menu/menu.test.tsx index b0b06108eb..4b27c7e916 100644 --- a/webapp/channels/src/components/menu/menu.test.tsx +++ b/webapp/channels/src/components/menu/menu.test.tsx @@ -140,7 +140,7 @@ describe('menu click handlers', () => { expect(screen.getByText('Open modal from submenu')).toBeInTheDocument(); // Press the down arrow once to focus first submenu item and then twice more to select the one we want - userEvent.keyboard('{arrowdown}{arrowdown}{arrowdown}'); + userEvent.keyboard('{arrowdown}{arrowdown}'); expect(screen.getByText('Open modal from submenu').closest('li')).toHaveFocus(); diff --git a/webapp/channels/src/components/menu/menu_item.tsx b/webapp/channels/src/components/menu/menu_item.tsx index f0a9e909d4..03004e3c95 100644 --- a/webapp/channels/src/components/menu/menu_item.tsx +++ b/webapp/channels/src/components/menu/menu_item.tsx @@ -309,6 +309,7 @@ export const MenuItemStyled = styled(MuiMenuItem, { flexWrap: 'nowrap', justifyContent: 'flex-end', color: isRegular ? 'rgba(var(--center-channel-color-rgb), 0.75)' : 'var(--error-text)', + marginInlineStart: '24px', gap: '4px', fontSize: '12px', lineHeight: '16px', diff --git a/webapp/channels/src/components/menu/sub_menu.tsx b/webapp/channels/src/components/menu/sub_menu.tsx index a54111f5ea..1fb001f43f 100644 --- a/webapp/channels/src/components/menu/sub_menu.tsx +++ b/webapp/channels/src/components/menu/sub_menu.tsx @@ -1,8 +1,8 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import MuiMenu from '@mui/material/Menu'; import MuiMenuList from '@mui/material/MenuList'; +import MuiPopover from '@mui/material/Popover'; import type {PopoverOrigin} from '@mui/material/Popover'; import React, { useState, @@ -33,6 +33,8 @@ import {SubMenuContext, useMenuContextValue} from './menu_context'; import {MenuItem} from './menu_item'; import type {Props as MenuItemProps} from './menu_item'; +import './menu.scss'; + interface Props { id: MenuItemProps['id']; leadingElement?: MenuItemProps['leadingElement']; @@ -47,6 +49,7 @@ interface Props { menuAriaDescribedBy?: string; forceOpenOnLeft?: boolean; // Most of the times this is not needed, since submenu position is calculated and placed + subMenuHeader?: ReactNode; children: ReactNode; } @@ -63,6 +66,7 @@ export function SubMenu(props: Props) { menuAriaDescribedBy, forceOpenOnLeft, children, + subMenuHeader, ...rest } = props; @@ -136,6 +140,7 @@ export function SubMenu(props: Props) { menuId, menuAriaLabel, children, + subMenuHeader, }, })); } @@ -166,35 +171,30 @@ export function SubMenu(props: Props) { onMouseLeave={handleMouseLeave} onKeyDown={handleKeyDown} > - - {/* This component is needed here to re enable pointer events for the submenu items which we had to disable above as */} - {/* pointer turns to default as soon as it leaves the parent menu */} - {/* Notice we dont use the below component in menu.tsx */} - + - + {subMenuHeader} + {children} - - - + + + ); } @@ -203,6 +203,7 @@ interface SubMenuModalProps { menuId: Props['menuId']; menuAriaLabel?: Props['menuAriaLabel']; children: Props['children']; + subMenuHeader?: ReactNode; } function SubMenuModal(props: SubMenuModalProps) { @@ -224,9 +225,11 @@ function SubMenuModal(props: SubMenuModalProps) { className='menuModal' > + {props.subMenuHeader} {props.children} diff --git a/webapp/channels/src/components/user_account_menu/__snapshots__/user_account_name_menuitem.test.tsx.snap b/webapp/channels/src/components/user_account_menu/__snapshots__/user_account_name_menuitem.test.tsx.snap index 503dd88dda..a2cb92e893 100644 --- a/webapp/channels/src/components/user_account_menu/__snapshots__/user_account_name_menuitem.test.tsx.snap +++ b/webapp/channels/src/components/user_account_menu/__snapshots__/user_account_name_menuitem.test.tsx.snap @@ -4,7 +4,7 @@ exports[`UserAccountNameMenuItem should not break if no props are passed 1`] = `