Make styling for the user menu more specific (#34679)

* Make user menu styles more specific

Only constrain the text elements that need to be constrained rather
than applying overflow: hidden to all children.

* Snapshot
This commit is contained in:
David Baker
2026-08-13 14:27:30 +00:00
committed by GitHub
parent 5d522035f4
commit 366dd99b4d
3 changed files with 22 additions and 6 deletions
@@ -26,8 +26,12 @@
display: flex;
flex-direction: column;
gap: var(--cpd-space-2x);
> * {
margin: auto;
}
.constrainedText {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
@@ -171,13 +171,25 @@ export function UserMenuView({ vm, className }: UserMenuViewProps): JSX.Element
>
<section className={classNames(styles.profile, styles.profilePrimary)}>
{showAvatar && <Avatar id={userId} name={displayName} type="round" size="64px" src={avatarUrl} />}
<Text className={styles.displayname} type="body" size="lg" weight="semibold" as="span">
<Text
className={classNames(styles.displayname, styles.constrainedText)}
type="body"
size="lg"
weight="semibold"
as="span"
>
{displayName}
</Text>
{showUserStatus && <SetStatusView vm={setStatusViewModel} />}
</section>
<section className={classNames(styles.profile, styles.profileSecondary)}>
<Text data-testid="userId" size="md" as="span" type="body" className={styles.userId}>
<Text
data-testid="userId"
size="md"
as="span"
type="body"
className={classNames(styles.userId, styles.constrainedText)}
>
{userId}
</Text>
{manageAccountHref && (
@@ -289,7 +289,7 @@ exports[`UserMenu > renders a menu without an avatar 1`] = `
class="UserMenu-module_profile UserMenu-module_profilePrimary"
>
<span
class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74 UserMenu-module_displayname"
class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74 UserMenu-module_displayname UserMenu-module_constrainedText"
>
Sally Sanderson
</span>
@@ -450,7 +450,7 @@ exports[`UserMenu > renders a menu without an avatar 1`] = `
class="UserMenu-module_profile UserMenu-module_profileSecondary"
>
<span
class="_typography_6v6n8_153 _font-body-md-regular_6v6n8_50 UserMenu-module_userId"
class="_typography_6v6n8_153 _font-body-md-regular_6v6n8_50 UserMenu-module_userId UserMenu-module_constrainedText"
data-testid="userId"
>
@person-name:homeserver.com
@@ -777,7 +777,7 @@ exports[`UserMenu > renders an open menu 1`] = `
/>
</span>
<span
class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74 UserMenu-module_displayname"
class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74 UserMenu-module_displayname UserMenu-module_constrainedText"
>
Sally Sanderson with a longer name
</span>
@@ -938,7 +938,7 @@ exports[`UserMenu > renders an open menu 1`] = `
class="UserMenu-module_profile UserMenu-module_profileSecondary"
>
<span
class="_typography_6v6n8_153 _font-body-md-regular_6v6n8_50 UserMenu-module_userId"
class="_typography_6v6n8_153 _font-body-md-regular_6v6n8_50 UserMenu-module_userId UserMenu-module_constrainedText"
data-testid="userId"
>
@person-name:homeserver.com