Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/showcase/src/stories/Shell.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { icons } from '@ferrlabs/ui-foundation/icons';
import type { Meta, StoryObj } from '@storybook/angular';
import { moduleMetadata } from '@storybook/angular';
import { expect, waitFor } from 'storybook/test';
import { expect, waitFor, within } from 'storybook/test';

const ORGS: readonly ProjectSwitcherItem[] = [
{ id: 'ferrlabs', label: 'FerrLabs', meta: 'ferrlabs' },
Expand Down Expand Up @@ -293,9 +293,8 @@ export const CollapsedRailShowsOnlyTheAvatar: Story = {
...Merged,
args: { collapsed: true },
play: async ({ canvasElement }) => {
const trigger = canvasElement.querySelector<HTMLButtonElement>('flr-user-menu button');
if (!trigger) throw new Error('user menu trigger not found');
await expect(trigger.getAttribute('aria-label')).toBe('Ada Doe');
const trigger = within(canvasElement).getByRole('button', { name: 'Ada Doe' });
await expect(trigger.closest('flr-user-menu')).not.toBeNull();
await expect(trigger.textContent).not.toContain('ada@ferrlabs.com');
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class AppSwitcherComponent {
const label = this.ariaLabel();
if (label) return label;
const item = this.currentItem();
if (item && !this.compact()) return null;
return item ? `${this.caption()}, ${item.label}` : this.caption();
});

Expand Down
2 changes: 2 additions & 0 deletions packages/ui-ng/src/lib/avatar/avatar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const SIZE_MAP: Record<Exclude<AvatarSize, number>, number> = {
} @else {
<span
class="flr-avatar__fallback"
role="img"
[attr.aria-label]="alt() ?? name()"
[title]="name()"
[style.width.px]="px()"
[style.height.px]="px()"
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-ng/src/lib/shell/shell.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ export interface ShellNavGroup {
<button
type="button"
class="flr-shell__search mono"
aria-label="Open search (Cmd+K)"
aria-keyshortcuts="Meta+K Control+K"
(click)="search.emit()"
>
<span>Search</span>
<kbd class="flr-shell__kbd">⌘K</kbd>
<kbd class="flr-shell__kbd" aria-hidden="true">⌘K</kbd>
</button>
}
<div class="flr-shell__slot"><ng-content select="[shell-actions]" /></div>
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-ng/src/lib/user-menu/user-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export interface UserMenuItem {
[class.flr-um__trigger--rail]="inRail"
[class.flr-um__trigger--compact]="compact()"
[title]="name()"
[attr.aria-label]="compact() ? name() : null"
>
<flr-avatar
[attr.aria-hidden]="nameShown() || null"
[name]="name()"
[src]="avatarSrc()"
[accent]="accent()"
Expand Down Expand Up @@ -192,4 +192,5 @@ export class UserMenuComponent {
private readonly shell = inject(SHELL_CONTEXT, { optional: true });
protected readonly inRail = this.shell !== null;
protected readonly compact = computed(() => this.shell?.collapsed() ?? false);
protected readonly nameShown = computed(() => (this.inRail ? !this.compact() : this.showName()));
}
Loading
Loading