From d5846caddd925d62ca6e505ae430e3ab48cf8087 Mon Sep 17 00:00:00 2001 From: Anastasiia Balenko Date: Mon, 30 Nov 2026 09:53:25 +0000 Subject: [PATCH 1/5] use support header abTest to determine "log in" text --- .../src/components/Dropdown.island.tsx | 15 +- .../src/components/Dropdown.test.tsx | 38 ----- .../src/components/TopBar.island.tsx | 12 +- .../src/components/TopBarMyAccount.test.tsx | 40 ++++- .../src/components/TopBarMyAccount.tsx | 152 ++++++------------ .../src/components/TopBarSupport.island.tsx | 37 ++++- 6 files changed, 136 insertions(+), 158 deletions(-) diff --git a/dotcom-rendering/src/components/Dropdown.island.tsx b/dotcom-rendering/src/components/Dropdown.island.tsx index b2e0d1187df..e9ca6c71429 100644 --- a/dotcom-rendering/src/components/Dropdown.island.tsx +++ b/dotcom-rendering/src/components/Dropdown.island.tsx @@ -40,10 +40,7 @@ interface Props { links: DropdownLinkType[]; dataLinkName: string; cssOverrides?: SerializedStyles; - linkCssOverrides?: SerializedStyles; - buttonCssOverrides?: SerializedStyles; children?: React.ReactNode; - renderTrigger?: (isExpanded: boolean) => React.ReactNode; ariaLabel?: string; } @@ -283,9 +280,8 @@ const NotificationMessage = ({ notification }: NotificationMessageProps) => { type DropdownLinkProps = { link: DropdownLinkType; index: number; - linkCssOverrides?: SerializedStyles; }; -const DropdownLink = ({ link, index, linkCssOverrides }: DropdownLinkProps) => { +const DropdownLink = ({ link, index }: DropdownLinkProps) => { const ophanComponent = useMemo( () => buildOphanComponentWithNotifications(link), [link], @@ -362,7 +358,6 @@ const DropdownLink = ({ link, index, linkCssOverrides }: DropdownLinkProps) => { href={url} css={[ linkStyles, - linkCssOverrides, !!link.isActive && linkActive, index === 0 && linkFirst, ]} @@ -401,10 +396,7 @@ export const Dropdown = ({ links, dataLinkName, cssOverrides, - linkCssOverrides, - buttonCssOverrides, children, - renderTrigger, ariaLabel, }: Props) => { const [isExpanded, setIsExpanded] = useState(false); @@ -500,7 +492,6 @@ export const Dropdown = ({ href={l.url} css={[ linkStyles, - linkCssOverrides, !!l.isActive && linkActive, index === 0 && linkFirst, ]} @@ -519,7 +510,6 @@ export const Dropdown = ({ css={[ buttonStyles, cssOverrides, - buttonCssOverrides, isExpanded && buttonExpanded, ]} aria-label={ariaLabel} @@ -529,7 +519,7 @@ export const Dropdown = ({ type="button" ref={setButtonRef} > - {renderTrigger ? renderTrigger(isExpanded) : label} + {label} {notificationCount > 0 && (
@@ -550,7 +540,6 @@ export const Dropdown = ({ key={link.id} link={link} index={index} - linkCssOverrides={linkCssOverrides} /> ))} diff --git a/dotcom-rendering/src/components/Dropdown.test.tsx b/dotcom-rendering/src/components/Dropdown.test.tsx index 941d9b48152..97e356b0da7 100644 --- a/dotcom-rendering/src/components/Dropdown.test.tsx +++ b/dotcom-rendering/src/components/Dropdown.test.tsx @@ -136,44 +136,6 @@ describe('Dropdown', () => { expect(ulElement).toBeVisible(); }); - it('should pass the expanded state to a nested trigger and toggle once per click', () => { - const renderTrigger = jest.fn(() => ( - - Nested trigger - - )); - const { getByRole, getByText } = render( - - - , - ); - - const button = getByRole('button'); - expect(renderTrigger).toHaveBeenLastCalledWith(false); - expect(button).toHaveAttribute('aria-expanded', 'false'); - - fireEvent.click(getByText('Nested trigger')); - expect(renderTrigger).toHaveBeenLastCalledWith(true); - expect(button).toHaveAttribute('aria-expanded', 'true'); - - fireEvent.click(getByText('Nested trigger')); - expect(renderTrigger).toHaveBeenLastCalledWith(false); - expect(button).toHaveAttribute('aria-expanded', 'false'); - }); - it('should close the expanded menu when they click away', () => { const { container, getByRole } = render( (); const hasHydrated = useHydrated(); useEffect(() => { @@ -173,6 +176,9 @@ export const TopBar = ({ tagIds={tagIds} sectionId={sectionId} contentType={contentType} + onShowSignInTextOnMobileChange={ + setShowSignInTextOnMobile + } /> )} @@ -216,7 +222,11 @@ export const TopBar = ({ discussionApiUrl={discussionApiUrl} idApiUrl={idApiUrl} authStatus={authStatus} - showSignInTextOnMobile={true} + showSignInTextOnMobile={showSignInTextOnMobile ?? false} + isSignInReady={ + !showReaderRevenueLinks || + showSignInTextOnMobile !== undefined + } />
diff --git a/dotcom-rendering/src/components/TopBarMyAccount.test.tsx b/dotcom-rendering/src/components/TopBarMyAccount.test.tsx index 0e417923ae7..6a7d19d954a 100644 --- a/dotcom-rendering/src/components/TopBarMyAccount.test.tsx +++ b/dotcom-rendering/src/components/TopBarMyAccount.test.tsx @@ -55,7 +55,43 @@ describe('TopBarMyAccount', () => { expect(signInLink).toHaveAttribute('aria-label', 'Sign in'); }); - it('opens the signed-in dropdown and preserves its analytics name', () => { + it('hides the sign-in control until it is ready', () => { + const { queryByRole } = renderWithConfig( + , + ); + + expect( + queryByRole('link', { name: 'Sign in' }), + ).not.toBeInTheDocument(); + }); + + it('shows the sign-in text when the fallback is enabled', () => { + const { getByRole } = renderWithConfig( + , + ); + + expect(getByRole('link', { name: 'Sign in' })).toHaveTextContent( + 'Sign in', + ); + }); + + it('shows the signed-in label on mobile and preserves its analytics name', () => { const { getByRole } = renderWithConfig( { 'data-link-name', 'header : topbar : my account', ); + expect(accountButton).toHaveTextContent('My account'); + expect(accountButton.querySelectorAll('svg')).toHaveLength(0); fireEvent.click(accountButton); diff --git a/dotcom-rendering/src/components/TopBarMyAccount.tsx b/dotcom-rendering/src/components/TopBarMyAccount.tsx index 1fee2f82be9..dd8dfa4822f 100644 --- a/dotcom-rendering/src/components/TopBarMyAccount.tsx +++ b/dotcom-rendering/src/components/TopBarMyAccount.tsx @@ -10,7 +10,7 @@ import { textSansBold17, until, } from '@guardian/source/foundations'; -import { Hide, SvgCross, SvgPerson } from '@guardian/source/react-components'; +import { Hide, SvgPerson } from '@guardian/source/react-components'; import { useEffect, useState } from 'react'; import { getZIndex } from '../lib/getZIndex'; import { getHeaderSignInUrl } from '../lib/headerSignInUrl'; @@ -38,6 +38,7 @@ interface MyAccountProps { idApiUrl: string; authStatus: AuthStatusOrPending; showSignInTextOnMobile: boolean; + isSignInReady?: boolean; } // when SignedIn, authStatus can only be one of the two SignedIn states @@ -148,41 +149,49 @@ export const buildIdentityLinks = ( const SignIn = ({ idUrl, showSignInTextOnMobile, + isSignInReady, }: { idUrl: string; showSignInTextOnMobile: boolean; -}) => ( - - {showSignInTextOnMobile ? ( - <> - Sign in{' '} - - ) : ( - <> - - Sign in - - - -
- -
-
- - )} -
-); - -export const dropDownOverrides = (showSignInTextOnMobile: boolean) => css` + isSignInReady: boolean; +}) => { + if (!isSignInReady) { + return null; + } + + return ( + + {showSignInTextOnMobile ? ( + <> + Sign in{' '} + + ) : ( + <> + + Sign in + + + +
+ +
+
+ + )} +
+ ); +}; + +export const dropDownOverrides = css` color: ${themePalette('--masthead-top-bar-link-text')}; padding-right: 0; padding-bottom: 0; @@ -210,18 +219,6 @@ export const dropDownOverrides = (showSignInTextOnMobile: boolean) => css` top: 56px; } } - ${!showSignInTextOnMobile && - css` - ${until.tablet} { - &::after { - display: none; - } - &:not(button) { - top: 52px; - } - padding: 0; - } - `} `; const signInCircleStyle = css` @@ -259,36 +256,13 @@ const desktopSignInLabelStyles = css` } `; -const myAccountButtonStyles = css` - padding-left: 0; - svg { - transform: translateY(1px); - } -`; - -const myAccountLabelStyles = css` - margin-left: 5px; -`; -const dropdownLinkStyles = (showSignInTextOnMobile: boolean) => css` - ${!showSignInTextOnMobile && - css` - ${until.tablet} { - padding: 16px 0 16px 24px; - - &::before { - left: 24px; - right: 0; - } - } - `} -`; - interface SignedInWithNotificationsProps { mmaUrl: string; idUrl: string; notifications: Notification[]; authStatus: SignedIn; showSignInTextOnMobile: boolean; + isSignInReady?: boolean; } const SignedInWithNotifications = ({ @@ -297,6 +271,7 @@ const SignedInWithNotifications = ({ notifications, authStatus, showSignInTextOnMobile, + isSignInReady = true, }: SignedInWithNotificationsProps) => { const userId = authStatus.idToken.claims.legacy_identity_id; @@ -305,6 +280,7 @@ const SignedInWithNotifications = ({ ); } @@ -317,37 +293,10 @@ const SignedInWithNotifications = ({ ); return ( -
+
+ - showSignInTextOnMobile ? ( - <> - - My account - - ) : ( - <> - - - - My account - - - - -
- {isExpanded ? : } -
-
- - ) - } ariaLabel="My account" links={identityLinksWithNotifications} id="topbar-my-account" @@ -356,9 +305,7 @@ const SignedInWithNotifications = ({ 'topbar', 'my account', )} - cssOverrides={dropDownOverrides(showSignInTextOnMobile)} - buttonCssOverrides={myAccountButtonStyles} - linkCssOverrides={dropdownLinkStyles(showSignInTextOnMobile)} + cssOverrides={dropDownOverrides} />
); @@ -401,6 +348,7 @@ export const TopBarMyAccount = ({ idApiUrl, authStatus, showSignInTextOnMobile, + isSignInReady = true, }: MyAccountProps) => { const { renderingTarget } = useConfig(); @@ -415,11 +363,13 @@ export const TopBarMyAccount = ({ authStatus={authStatus} renderingTarget={renderingTarget} showSignInTextOnMobile={showSignInTextOnMobile} + isSignInReady={isSignInReady} /> ) : ( )} diff --git a/dotcom-rendering/src/components/TopBarSupport.island.tsx b/dotcom-rendering/src/components/TopBarSupport.island.tsx index 80f334ad891..e1f31c1fb06 100644 --- a/dotcom-rendering/src/components/TopBarSupport.island.tsx +++ b/dotcom-rendering/src/components/TopBarSupport.island.tsx @@ -34,6 +34,7 @@ type Props = { tagIds?: string[]; sectionId?: string; contentType?: string; + onShowSignInTextOnMobileChange: (show: boolean) => void; }; const headerStyles = css` @@ -51,6 +52,7 @@ type ReaderRevenueLinksRemoteProps = { tagIds?: string[]; sectionId?: string; contentType?: string; + onShowSignInTextOnMobileChange: (show: boolean) => void; }; const ReaderRevenueLinksRemote = ({ @@ -61,6 +63,7 @@ const ReaderRevenueLinksRemote = ({ tagIds, sectionId, contentType, + onShowSignInTextOnMobileChange, }: ReaderRevenueLinksRemoteProps) => { const [supportHeaderResponse, setSupportHeaderResponse] = useState | null>(null); @@ -71,7 +74,7 @@ const ReaderRevenueLinksRemote = ({ const { renderingTarget } = useConfig(); const abTests = useAB(); - useEffect((): void => { + useEffect(() => { if (isUndefined(countryCode) || isSignedIn === 'Pending') { return; } @@ -104,16 +107,30 @@ const ReaderRevenueLinksRemote = ({ }, }; + let cancelled = false; getAuthHeaders() .then((headers) => getHeader(contributionsServiceUrl, requestData, headers), ) .then((response: ModuleDataResponse) => { + if (cancelled) { + return null; + } + if (!response.data) { + onShowSignInTextOnMobileChange(true); return null; } const { module } = response.data; + const { abTestName, abTestVariant } = module.props.tracking; + onShowSignInTextOnMobileChange( + !( + abTestName.startsWith('HEADER_MOBILE_SIGN_IN') && + abTestVariant && + abTestVariant !== 'CONTROL' + ), + ); setSupportHeaderResponse(module); return ( @@ -129,13 +146,19 @@ const ReaderRevenueLinksRemote = ({ React.ElementType >, ) => { - setSupportHeader( - () => headerModule[module.name] ?? null, - ); + if (!cancelled) { + setSupportHeader( + () => headerModule[module.name] ?? null, + ); + } }, ); }) .catch((error) => { + if (cancelled) { + return; + } + onShowSignInTextOnMobileChange(true); const msg = `Error importing RR header links: ${String(error)}`; console.log(msg); window.guardian.modules.sentry.reportError( @@ -143,6 +166,9 @@ const ReaderRevenueLinksRemote = ({ 'rr-header-links', ); }); + return () => { + cancelled = true; + }; }, [ countryCode, isSignedIn, @@ -153,6 +179,7 @@ const ReaderRevenueLinksRemote = ({ tagIds, sectionId, contentType, + onShowSignInTextOnMobileChange, ]); if (SupportHeader !== null && supportHeaderResponse) { @@ -201,6 +228,7 @@ export const TopBarSupport = ({ tagIds, sectionId, contentType, + onShowSignInTextOnMobileChange, }: Props) => { const { renderingTarget } = useConfig(); const countryCode = useCountryCode('support-the-Guardian'); @@ -219,6 +247,7 @@ export const TopBarSupport = ({ tagIds={tagIds} sectionId={sectionId} contentType={contentType} + onShowSignInTextOnMobileChange={onShowSignInTextOnMobileChange} /> ); }; From bbcea57163d891f407eaf2fac59b3c063b6b279c Mon Sep 17 00:00:00 2001 From: Anastasiia Balenko Date: Mon, 30 Nov 2026 11:57:00 +0000 Subject: [PATCH 2/5] test update --- .../src/components/TopBar.stories.tsx | 30 +++---------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/dotcom-rendering/src/components/TopBar.stories.tsx b/dotcom-rendering/src/components/TopBar.stories.tsx index 52194e96810..e753d51e61b 100644 --- a/dotcom-rendering/src/components/TopBar.stories.tsx +++ b/dotcom-rendering/src/components/TopBar.stories.tsx @@ -180,29 +180,9 @@ export const SignedInText = () => { }; SignedInText.parameters = accountStoryParameters; -export const SignedInNoText = () => { - return ( - - , - idToken: mockIdToken, - }} - showSignInTextOnMobile={false} - /> - - ); -}; -SignedInNoText.parameters = accountStoryParameters; - -export const SignedInNoTextExpanded = () => ; -SignedInNoTextExpanded.parameters = accountStoryParameters; -SignedInNoTextExpanded.play = async ({ +export const SignedInTextExpanded = () => ; +SignedInTextExpanded.parameters = accountStoryParameters; +SignedInTextExpanded.play = async ({ canvasElement, }: { canvasElement: HTMLElement; @@ -216,10 +196,8 @@ SignedInNoTextExpanded.play = async ({ const billingLink = await canvas.findByRole('link', { name: 'Billing' }); await expect(billingLink).toBeVisible(); - const expectedDividerLeft = - window.innerWidth < breakpoints.tablet ? '24px' : '30px'; await expect(window.getComputedStyle(billingLink, '::before').left).toBe( - expectedDividerLeft, + '30px', ); }; From d57d144d1a1c2020f0337d00af39aed78852cf26 Mon Sep 17 00:00:00 2001 From: Anastasiia Balenko Date: Mon, 30 Nov 2026 12:06:32 +0000 Subject: [PATCH 3/5] refactoring per comments --- .../src/components/TopBar.island.tsx | 17 ++- .../src/components/TopBarMyAccount.test.tsx | 131 +++++++++++++++++- .../src/components/TopBarMyAccount.tsx | 7 +- 3 files changed, 147 insertions(+), 8 deletions(-) diff --git a/dotcom-rendering/src/components/TopBar.island.tsx b/dotcom-rendering/src/components/TopBar.island.tsx index a6d1fa5f23e..5e5fe80c69d 100644 --- a/dotcom-rendering/src/components/TopBar.island.tsx +++ b/dotcom-rendering/src/components/TopBar.island.tsx @@ -36,6 +36,8 @@ interface Props { showReaderRevenueLinks?: boolean; } +const SIGN_IN_FALLBACK_TIMEOUT_MS = 2000; + const topBarStyles = css` grid-column: content-start / main-column-end; background-color: ${themePalette('--masthead-top-bar-background')}; @@ -146,6 +148,19 @@ export const TopBar = ({ setReferrerUrl(window.location.origin + window.location.pathname); }, []); + useEffect(() => { + if (!showReaderRevenueLinks || showSignInTextOnMobile !== undefined) { + return; + } + + const timeout = window.setTimeout(() => { + console.warn('Support header timed out; showing sign-in text.'); + setShowSignInTextOnMobile((current) => current ?? true); + }, SIGN_IN_FALLBACK_TIMEOUT_MS); + + return () => window.clearTimeout(timeout); + }, [showReaderRevenueLinks, showSignInTextOnMobile]); + useEffect(() => { if (authStatus.kind === 'SignedOut') { clearSubscriptionCache(); @@ -222,7 +237,7 @@ export const TopBar = ({ discussionApiUrl={discussionApiUrl} idApiUrl={idApiUrl} authStatus={authStatus} - showSignInTextOnMobile={showSignInTextOnMobile ?? false} + showSignInTextOnMobile={showSignInTextOnMobile ?? true} isSignInReady={ !showReaderRevenueLinks || showSignInTextOnMobile !== undefined diff --git a/dotcom-rendering/src/components/TopBarMyAccount.test.tsx b/dotcom-rendering/src/components/TopBarMyAccount.test.tsx index 6a7d19d954a..30521e42d4d 100644 --- a/dotcom-rendering/src/components/TopBarMyAccount.test.tsx +++ b/dotcom-rendering/src/components/TopBarMyAccount.test.tsx @@ -1,8 +1,9 @@ import type { AccessToken, IDToken } from '@guardian/identity-auth'; -import { fireEvent, render } from '@testing-library/react'; +import { act, fireEvent, render } from '@testing-library/react'; import type { ReactElement } from 'react'; import type { CustomIdTokenClaims, SignedIn } from '../lib/identity'; import { ConfigProvider } from './ConfigContext'; +import { TopBar } from './TopBar.island'; import { TopBarMyAccount } from './TopBarMyAccount'; jest.mock('../lib/useBraze', () => ({ @@ -11,6 +12,41 @@ jest.mock('../lib/useBraze', () => ({ }), })); +jest.mock('../static/icons/profile.svg', () => () => ( + +)); + +jest.mock('../lib/useAuthStatus', () => ({ + useAuthStatus: () => ({ kind: 'SignedOut' }), +})); + +jest.mock('../lib/useHydrated', () => ({ + useHydrated: () => true, +})); + +jest.mock('../lib/usePageViewId', () => ({ + usePageViewId: () => 'page-view-id', +})); + +jest.mock('../lib/newsletterSubscriptionCache', () => ({ + clearSubscriptionCache: jest.fn(), +})); + +jest.mock('./TopBarSupport.island', () => ({ + TopBarSupport: ({ + onShowSignInTextOnMobileChange, + }: { + onShowSignInTextOnMobileChange: (show: boolean) => void; + }) => ( + + ), +})); + const renderWithConfig = (component: ReactElement) => render( { expect(signInLink).toHaveAttribute('aria-label', 'Sign in'); }); + describe('TopBar sign-in fallback', () => { + beforeEach(() => { + jest.useFakeTimers(); + jest.spyOn(console, 'warn').mockImplementation(() => undefined); + }); + + afterEach(() => { + jest.restoreAllMocks(); + jest.useRealTimers(); + }); + + const renderTopBar = (showReaderRevenueLinks = true) => + renderWithConfig( + , + ); + + it('shows text immediately when reader revenue links are disabled', () => { + const { getByRole } = renderTopBar(false); + expect(getByRole('link', { name: 'Sign in' })).not.toHaveAttribute( + 'aria-label', + ); + }); + + it('shows text after the timeout and applies a late treatment decision', () => { + const { getByRole, queryByRole } = renderTopBar(); + + act(() => { + jest.advanceTimersByTime(1999); + }); + expect( + queryByRole('link', { name: 'Sign in' }), + ).not.toBeInTheDocument(); + + act(() => { + jest.advanceTimersByTime(1); + }); + expect(getByRole('link', { name: 'Sign in' })).not.toHaveAttribute( + 'aria-label', + ); + expect(console.warn).toHaveBeenCalledWith( + 'Support header timed out; showing sign-in text.', + ); + + fireEvent.click(getByRole('button', { name: 'Select treatment' })); + expect(getByRole('link', { name: 'Sign in' })).toHaveAttribute( + 'aria-label', + 'Sign in', + ); + }); + + it('does not replace a timely treatment decision with the fallback', () => { + const { getByRole } = renderTopBar(); + + fireEvent.click(getByRole('button', { name: 'Select treatment' })); + act(() => { + jest.advanceTimersByTime(2000); + }); + + expect(getByRole('link', { name: 'Sign in' })).toHaveAttribute( + 'aria-label', + 'Sign in', + ); + expect(console.warn).not.toHaveBeenCalled(); + }); + + it('clears the fallback timer on unmount', () => { + const { unmount } = renderTopBar(); + unmount(); + + act(() => { + jest.advanceTimersByTime(2000); + }); + expect(console.warn).not.toHaveBeenCalled(); + }); + }); + it('hides the sign-in control until it is ready', () => { const { queryByRole } = renderWithConfig( { ); }); - it('shows the signed-in label on mobile and preserves its analytics name', () => { - const { getByRole } = renderWithConfig( + it('shows the signed-in label and opens the menu when the icon is clicked', () => { + const { getByRole, getByTestId } = renderWithConfig( { 'header : topbar : my account', ); expect(accountButton).toHaveTextContent('My account'); - expect(accountButton.querySelectorAll('svg')).toHaveLength(0); + const icon = getByTestId('profile-icon'); + expect(accountButton).toContainElement(icon); - fireEvent.click(accountButton); + fireEvent.click(icon); expect(accountButton).toHaveAttribute('aria-expanded', 'true'); expect(getByRole('link', { name: 'Billing' })).toBeVisible(); + fireEvent.click(icon); + expect(accountButton).toHaveAttribute('aria-expanded', 'false'); }); }); diff --git a/dotcom-rendering/src/components/TopBarMyAccount.tsx b/dotcom-rendering/src/components/TopBarMyAccount.tsx index dd8dfa4822f..1b96b7ae0c6 100644 --- a/dotcom-rendering/src/components/TopBarMyAccount.tsx +++ b/dotcom-rendering/src/components/TopBarMyAccount.tsx @@ -294,9 +294,12 @@ const SignedInWithNotifications = ({ return (
- + My account + + } ariaLabel="My account" links={identityLinksWithNotifications} id="topbar-my-account" From dbd6c8412f5406eba9df524496b2f5ce5cf0e01d Mon Sep 17 00:00:00 2001 From: Anastasiia Balenko Date: Mon, 30 Nov 2026 12:41:09 +0000 Subject: [PATCH 4/5] fix padding and stories --- .../src/components/TopBar.stories.tsx | 22 ------------------- .../src/components/TopBarMyAccount.tsx | 7 +++++- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/dotcom-rendering/src/components/TopBar.stories.tsx b/dotcom-rendering/src/components/TopBar.stories.tsx index e753d51e61b..5b81431d336 100644 --- a/dotcom-rendering/src/components/TopBar.stories.tsx +++ b/dotcom-rendering/src/components/TopBar.stories.tsx @@ -3,7 +3,6 @@ import type { AccessToken, IDToken } from '@guardian/identity-auth'; import { breakpoints, from } from '@guardian/source/foundations'; import type { Meta } from '@storybook/react-webpack5'; import type { PropsWithChildren } from 'react'; -import { expect, userEvent, within } from 'storybook/test'; import { contributionsHeaderResponse, contributionsSignInPromptHeaderResponse, @@ -180,27 +179,6 @@ export const SignedInText = () => { }; SignedInText.parameters = accountStoryParameters; -export const SignedInTextExpanded = () => ; -SignedInTextExpanded.parameters = accountStoryParameters; -SignedInTextExpanded.play = async ({ - canvasElement, -}: { - canvasElement: HTMLElement; -}) => { - const canvas = within(canvasElement); - const button = await canvas.findByTestId('dropdown-button'); - - await userEvent.click(button); - await expect(button).toHaveAttribute('aria-expanded', 'true'); - - const billingLink = await canvas.findByRole('link', { name: 'Billing' }); - await expect(billingLink).toBeVisible(); - - await expect(window.getComputedStyle(billingLink, '::before').left).toBe( - '30px', - ); -}; - export const SignedOutText = () => { return ( diff --git a/dotcom-rendering/src/components/TopBarMyAccount.tsx b/dotcom-rendering/src/components/TopBarMyAccount.tsx index 1b96b7ae0c6..e1b3256f800 100644 --- a/dotcom-rendering/src/components/TopBarMyAccount.tsx +++ b/dotcom-rendering/src/components/TopBarMyAccount.tsx @@ -256,6 +256,10 @@ const desktopSignInLabelStyles = css` } `; +const myAccountLabelStyles = css` + margin-left: 5px; +`; + interface SignedInWithNotificationsProps { mmaUrl: string; idUrl: string; @@ -297,7 +301,8 @@ const SignedInWithNotifications = ({ - My account + + My account } ariaLabel="My account" From b04cdb224eef2a9de14aefbdc2fbdcdf41f07b0e Mon Sep 17 00:00:00 2001 From: Anastasiia Balenko Date: Mon, 30 Nov 2026 13:29:59 +0000 Subject: [PATCH 5/5] reset state when no data returned or failed request --- dotcom-rendering/src/components/TopBarSupport.island.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dotcom-rendering/src/components/TopBarSupport.island.tsx b/dotcom-rendering/src/components/TopBarSupport.island.tsx index e1f31c1fb06..14560a9a4ff 100644 --- a/dotcom-rendering/src/components/TopBarSupport.island.tsx +++ b/dotcom-rendering/src/components/TopBarSupport.island.tsx @@ -118,6 +118,8 @@ const ReaderRevenueLinksRemote = ({ } if (!response.data) { + setSupportHeader(null); + setSupportHeaderResponse(null); onShowSignInTextOnMobileChange(true); return null; } @@ -158,6 +160,8 @@ const ReaderRevenueLinksRemote = ({ if (cancelled) { return; } + setSupportHeader(null); + setSupportHeaderResponse(null); onShowSignInTextOnMobileChange(true); const msg = `Error importing RR header links: ${String(error)}`; console.log(msg);