diff --git a/components/email/__tests__/composer-plugin-surfaces.test.tsx b/components/email/__tests__/composer-plugin-surfaces.test.tsx index 73dacdb35..02c24baf8 100644 --- a/components/email/__tests__/composer-plugin-surfaces.test.tsx +++ b/components/email/__tests__/composer-plugin-surfaces.test.tsx @@ -366,6 +366,11 @@ describe('composer-options-menu and composer-toolbar-actions', () => { const button = screen.getByRole('button', { name: 'Assistant' }); expect(button).toHaveAttribute('title', 'Assistant (Alt+A)'); expect(button.className).toContain('h-9'); + // Icon only unless the bar is wide enough for the label next to the app's buttons. + expect(button.querySelector('span')!.className).toContain('@[44rem]/composer-bar:inline'); + let bar: HTMLElement | null = button; + while (bar && !bar.classList.contains('@container/composer-bar')) bar = bar.parentElement; + expect(bar).not.toBeNull(); // Not in the plugin frame row above the bar. expect(button.closest('[data-composer-plugin-row]')).toBeNull(); await act(async () => { fireEvent.click(button); }); diff --git a/components/email/composer-toolbar-menu.tsx b/components/email/composer-toolbar-menu.tsx index 0c7c26c34..b0a9925f1 100644 --- a/components/email/composer-toolbar-menu.tsx +++ b/components/email/composer-toolbar-menu.tsx @@ -178,7 +178,9 @@ export function ComposerPluginToolbarButtons({ surface, context }: { surface: "c onClick={() => { void runAction(action, surface, context()); }} > - {action.label} + {/* The label only when the bar has room for it next to the app's own + buttons; otherwise the icon, with the label as tooltip. */} + {action.label} ); })} diff --git a/components/email/email-composer.tsx b/components/email/email-composer.tsx index ceb8a8a59..14e89eca7 100644 --- a/components/email/email-composer.tsx +++ b/components/email/email-composer.tsx @@ -3995,7 +3995,7 @@ export function EmailComposer({