Skip to content

Commit 0da8f2d

Browse files
committed
feat: remove mobile title overflow checks and unify title width handling
1 parent 5a9644a commit 0da8f2d

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

packages/devtools-seo/src/tabs/serp-preview.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type { SeoIssue, SeoSectionSummary } from '../utils/seo-section-summary'
88

99
const ELLIPSIS = '...'
1010
const DESKTOP_TITLE_MAX_WIDTH_PX = 620
11-
const MOBILE_TITLE_MAX_WIDTH_PX = 328
1211
const DESKTOP_DESCRIPTION_TOTAL_WIDTH_PX = 960
1312
const DESKTOP_DESCRIPTION_MAX_LINES = 2
1413
const MOBILE_DESCRIPTION_WIDTH_PX = 320
@@ -26,7 +25,6 @@ type SerpData = {
2625

2726
type SerpOverflow = {
2827
titleOverflowDesktop: boolean
29-
titleOverflowMobile: boolean
3028
descriptionOverflow: boolean
3129
descriptionOverflowMobile: boolean
3230
}
@@ -85,10 +83,6 @@ const SERP_PREVIEWS: Array<SerpPreview> = [
8583
label: 'Mobile preview',
8684
isMobile: true,
8785
extraChecks: [
88-
{
89-
message: `The title is wider than ${MOBILE_TITLE_MAX_WIDTH_PX}px and may be trimmed in the mobile preview.`,
90-
hasIssue: (_, overflow) => overflow.titleOverflowMobile,
91-
},
9286
{
9387
message:
9488
'Description exceeds the 3-line limit for mobile view. Please shorten your text to fit within 3 lines.',
@@ -314,7 +308,7 @@ function getSerpPreviewState(data: SerpData): SerpPreviewState {
314308
),
315309
displayTitleMobile: truncateToWidth(
316310
titleText,
317-
MOBILE_TITLE_MAX_WIDTH_PX,
311+
DESKTOP_TITLE_MAX_WIDTH_PX,
318312
TITLE_FONT,
319313
),
320314
displayDescriptionDesktop: truncateToTotalWrappedWidth(
@@ -332,8 +326,6 @@ function getSerpPreviewState(data: SerpData): SerpPreviewState {
332326
overflow: {
333327
titleOverflowDesktop:
334328
measureTextWidth(titleText, TITLE_FONT) > DESKTOP_TITLE_MAX_WIDTH_PX,
335-
titleOverflowMobile:
336-
measureTextWidth(titleText, TITLE_FONT) > MOBILE_TITLE_MAX_WIDTH_PX,
337329
descriptionOverflow:
338330
desktopDescriptionLines.length > DESKTOP_DESCRIPTION_MAX_LINES ||
339331
desktopDescriptionLines.reduce(
@@ -416,12 +408,6 @@ export function getSerpPreviewSummary(): SeoSectionSummary {
416408
message: `The title is wider than ${DESKTOP_TITLE_MAX_WIDTH_PX}px and it may not be displayed in full length.`,
417409
})
418410
}
419-
if (overflow.titleOverflowMobile) {
420-
issues.push({
421-
severity: 'warning',
422-
message: `The title is wider than ${MOBILE_TITLE_MAX_WIDTH_PX}px and may be trimmed in the mobile preview.`,
423-
})
424-
}
425411
if (overflow.descriptionOverflow) {
426412
issues.push({
427413
severity: 'warning',

0 commit comments

Comments
 (0)