Skip to content
Open
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
9 changes: 9 additions & 0 deletions .changeset/org-switcher-polish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@clerk/ui': patch
---

Polish the `<OrganizationSwitcher />`:

- Decode avatar images synchronously so a freshly mounted avatar (e.g. when the popover opens) paints on its first frame instead of briefly flashing the avatar background.
- Highlight the trigger while its popover is open.
- Align the "Create organization" action's height with the other rows for a consistent list.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export const OrganizationSwitcherTrigger = withAvatarShimmer(
t => ({
padding: `${t.space.$1} ${t.space.$2}`,
position: 'relative',
'&[aria-expanded="true"]': {
backgroundColor: 'var(--alpha)',
color: 'var(--accentHover)',
},
}),
sx,
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ const CreateOrganizationButton = ({
label={localizationKeys('organizationSwitcher.action__createOrganization')}
onClick={onCreateOrganizationClick}
sx={t => ({
padding: `${t.space.$5} ${t.space.$5}`,
padding: `${t.space.$4} ${t.space.$5}`,
})}
iconSx={t => ({
width: t.sizes.$9,
height: t.sizes.$6,
})}
iconBoxSx={t => ({
width: t.sizes.$9,
height: t.sizes.$6,
height: t.sizes.$9,
})}
spinnerSize='sm'
/>
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/src/elements/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export const Avatar = (props: AvatarProps) => {
title={title}
alt={`${title}'s logo`}
src={imageUrl || ''}
// Decode the (typically cached) avatar bytes before presenting so a freshly-mounted
// <img> paints on its first frame instead of flashing the avatar background for a tick.
// Safe for avatar-sized images: decode is off-thread/sub-ms and only affects already-fetched bytes.
decoding='sync'
sx={{
objectFit: 'cover',
width: '100%',
Expand Down
Loading