diff --git a/assets/js/modules/analytics-4/components/common/tiles/TileShell.tsx b/assets/js/modules/analytics-4/components/common/tiles/TileShell.tsx index 9498e76e06f..8b95b1dfcca 100644 --- a/assets/js/modules/analytics-4/components/common/tiles/TileShell.tsx +++ b/assets/js/modules/analytics-4/components/common/tiles/TileShell.tsx @@ -35,7 +35,7 @@ export interface TileShellProps { className?: string; /** Tile title, shown as the heading element that `titleAs` sets. */ title: ReactNode; - /** Heading element of the title, `h3` by default, or `h4` for a tile under an `h3` heading. */ + /** Heading element of the title, `h3` by default. */ titleAs?: 'h3' | 'h4'; /** Label at the end of the header, such as a column name. */ headerLabel?: string; diff --git a/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostPerformance.test.tsx b/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostPerformance.test.tsx index b65837f43ab..a3287210c16 100644 --- a/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostPerformance.test.tsx +++ b/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostPerformance.test.tsx @@ -171,6 +171,32 @@ describe( 'LatestPostPerformance', () => { ] ); } ); + it( 'should render the titles of the tiles as headings one level below the heading of the section', async () => { + provideLatestPostKeywordReport( registry ); + + const { getAllByRole, waitForRegistry } = render( + , + { registry } + ); + + await waitForRegistry(); + + expect( + getAllByRole( 'heading', { level: 3 } ).map( + ( heading ) => heading.textContent + ) + ).toEqual( [ 'Latest post performance since published' ] ); + expect( + getAllByRole( 'heading', { level: 4 } ).map( + ( heading ) => heading.textContent + ) + ).toEqual( [ + 'Visitor breakdown', + 'Traffic sources', + 'Engagement & outcomes', + ] ); + } ); + it( 'should request the top keyword for the post URL on the reference site, and should keep the Analytics rows, when the reference site URL differs from the home URL', async () => { provideSiteInfo( registry, { homeURL: 'https://example.com/', diff --git a/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostTile.tsx b/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostTile.tsx index 6e61bb9557a..5b2c3cf9271 100644 --- a/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostTile.tsx +++ b/assets/js/modules/analytics-4/components/traffic-overview/recent-activity/LatestPostTile.tsx @@ -37,6 +37,7 @@ const LatestPostTile: FC< LatestPostTileProps > = ( { title, children } ) => { baseClassName="googlesitekit-table-tile" className="googlesitekit-traffic-overview__latest-post-tile" title={ title } + titleAs="h4" > { children }