fix(web): keep the workspace title from stretching between tabs (UF-049)
The title carries a framer-motion layoutId for the card-to-header hero morph, which also animates any change of its box. With a short workspace name the title is as wide as the subtitle row; hiding that row on the Chat tab changed the width, and framer animated it as a horizontal scale (2.9x for "Eng"). Both titles now use layout="position": only the position animates, and the hero morph still moves the name into place. The hero-morph test checks it.
This commit is contained in:
@@ -525,6 +525,9 @@ const WorkspaceDesktopApp = ({
|
||||
<div className="mb-1.5 h-2.5 w-24 rounded bg-[var(--surface-2)] animate-pulse motion-reduce:animate-none" aria-hidden="true" />
|
||||
<motion.h2
|
||||
layoutId={heroNameId}
|
||||
// Text must not scale: the title's width follows the header row,
|
||||
// which changes between tabs (UF-049). Only its position travels.
|
||||
layout="position"
|
||||
transition={SPRING.expressive}
|
||||
className="truncate font-display text-[clamp(20px,2.4vw,28px)] font-semibold leading-tight tracking-[-0.02em] text-[var(--text)]"
|
||||
>
|
||||
@@ -645,6 +648,9 @@ const WorkspaceDesktopApp = ({
|
||||
</div>
|
||||
<motion.h2
|
||||
layoutId={heroNameId}
|
||||
// Text must not scale: the title's width follows the header row,
|
||||
// which changes between tabs (UF-049). Only its position travels.
|
||||
layout="position"
|
||||
transition={SPRING.expressive}
|
||||
className="truncate font-display text-[clamp(20px,2.4vw,28px)] font-semibold leading-tight tracking-[-0.02em] text-[var(--text)]"
|
||||
>
|
||||
|
||||
@@ -43,6 +43,7 @@ vi.mock('framer-motion', async () => {
|
||||
for (const k of Object.keys(props)) if (!DROP.has(k)) passed[k] = props[k];
|
||||
// Surface the two props the morph contract depends on.
|
||||
if (props.layoutId !== undefined) passed['data-layout-id'] = props.layoutId;
|
||||
if (typeof props.layout === 'string') passed['data-layout'] = props.layout;
|
||||
if (props.initial !== undefined) passed['data-initial'] = JSON.stringify(props.initial);
|
||||
return React.createElement(tag, { ...passed, ref });
|
||||
});
|
||||
@@ -180,6 +181,8 @@ describe('Lane HM · workspace surface (destination)', () => {
|
||||
const name = container.querySelector(`[data-layout-id="${workspaceHeroNameId('w1')}"]`);
|
||||
expect(avatar).toBeTruthy();
|
||||
expect(name?.textContent).toBe('Alpha');
|
||||
// UF-049: the title only moves; a size morph would stretch the text.
|
||||
expect(name?.getAttribute('data-layout')).toBe('position');
|
||||
});
|
||||
|
||||
it('the LOADING skeleton already carries the hero ids (target mounted at commit)', async () => {
|
||||
@@ -194,6 +197,7 @@ describe('Lane HM · workspace surface (destination)', () => {
|
||||
expect(container.querySelector(`[data-layout-id="${workspaceHeroAvatarId('w1')}"]`)).toBeTruthy();
|
||||
const name = container.querySelector(`[data-layout-id="${workspaceHeroNameId('w1')}"]`);
|
||||
expect(name?.textContent).toBe('Alpha');
|
||||
expect(name?.getAttribute('data-layout')).toBe('position');
|
||||
});
|
||||
|
||||
it('reduced motion drops the header layoutIds', async () => {
|
||||
|
||||
Reference in New Issue
Block a user