Skip to content

Commit 31be7f2

Browse files
authored
fix: [Enhanced navigation] Missing burger menu in embedded layout (#36398)
1 parent 2ce17ce commit 31be7f2

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

.changeset/hot-crabs-invite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket.chat/meteor': patch
3+
---
4+
5+
Fixes missing burger menu in embedded layout page header when using enhanced navigation feature preview

apps/meteor/client/components/Page/PageHeaderNoShadow.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type PageHeaderProps = {
1616
const PageHeaderNoShadow = ({ children = undefined, title, onClickBack, ...props }: PageHeaderProps) => {
1717
const { t } = useTranslation();
1818

19-
const { isMobile } = useLayout();
19+
const { isMobile, isTablet, isEmbedded } = useLayout();
2020

2121
useDocumentTitle(typeof title === 'string' ? title : undefined);
2222

@@ -32,16 +32,23 @@ const PageHeaderNoShadow = ({ children = undefined, title, onClickBack, ...props
3232
alignItems='center'
3333
color='default'
3434
>
35-
{isMobile && (
36-
<FeaturePreview feature='newNavigation'>
37-
<FeaturePreviewOff>
35+
<FeaturePreview feature='newNavigation'>
36+
<FeaturePreviewOff>
37+
{isMobile ? (
3838
<HeaderToolbar>
3939
<SidebarToggler />
4040
</HeaderToolbar>
41-
</FeaturePreviewOff>
42-
<FeaturePreviewOn>{null}</FeaturePreviewOn>
43-
</FeaturePreview>
44-
)}
41+
) : null}
42+
</FeaturePreviewOff>
43+
<FeaturePreviewOn>
44+
{isTablet && isEmbedded ? (
45+
<HeaderToolbar>
46+
<SidebarToggler />
47+
</HeaderToolbar>
48+
) : null}
49+
</FeaturePreviewOn>
50+
</FeaturePreview>
51+
4552
{onClickBack && <IconButton small mie={8} icon='arrow-back' onClick={onClickBack} title={t('Back')} />}
4653
<Box is='h1' fontScale='h2' flexGrow={1} data-qa-type='PageHeader-title'>
4754
{title}

apps/meteor/tests/e2e/feature-preview.spec.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,23 @@ test.describe.serial('feature preview', () => {
215215
await expect(poHomeChannel.sidebar.getItemUnreadBadge(collapser)).toBeVisible();
216216
});
217217

218-
test('should not show NavBar in embedded layout', async ({ page }) => {
218+
test('embedded layout', async ({ page }) => {
219219
await page.goto('/home');
220220

221-
await poHomeChannel.navbar.openChat(targetChannel);
222-
await expect(page.locator('role=navigation[name="header"]')).toBeVisible();
223-
const embeddedLayoutURL = `${page.url()}?layout=embedded`;
224-
await page.goto(embeddedLayoutURL);
225-
await expect(page.locator('role=navigation[name="header"]')).not.toBeVisible();
221+
await test.step('should not show NavBar', async () => {
222+
await poHomeChannel.navbar.openChat(targetChannel);
223+
await expect(page.locator('role=navigation[name="header"]')).toBeVisible();
224+
const embeddedLayoutURL = `${page.url()}?layout=embedded`;
225+
await page.goto(embeddedLayoutURL);
226+
await expect(page.locator('role=navigation[name="header"]')).not.toBeVisible();
227+
});
228+
229+
await test.step('should show burger menu', async () => {
230+
await page.goto('admin/info?layout=embedded');
231+
await page.setViewportSize({ width: 767, height: 510 });
232+
233+
await expect(poHomeChannel.content.burgerButton).toBeVisible();
234+
});
226235
});
227236

228237
test('should display the room header properly', async ({ page }) => {

apps/meteor/tests/e2e/page-objects/fragments/home-content.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export class HomeContent {
1515
return this.page.locator('main header');
1616
}
1717

18+
get burgerButton(): Locator {
19+
return this.channelHeader.getByRole('button', { name: 'Open sidebar' });
20+
}
21+
1822
get channelRetentionPolicyWarning(): Locator {
1923
return this.page.locator('main').getByRole('alert', { name: 'Retention policy warning banner' });
2024
}

0 commit comments

Comments
 (0)