From 2780f882138801cca72d867d049647ab6a46799e Mon Sep 17 00:00:00 2001 From: Josh Leibstein Date: Fri, 23 Aug 2024 14:54:30 +0100 Subject: [PATCH] Adjust viewport for plain text (#1016) --- src/features/web-compat.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/features/web-compat.js b/src/features/web-compat.js index d86eef154..cdc7aabcd 100644 --- a/src/features/web-compat.js +++ b/src/features/web-compat.js @@ -635,7 +635,12 @@ export class WebCompat extends ContentFeature { forcedValues['maximum-scale'] = 10 } - if (!viewportTag || this.desktopModeEnabled) { + if (this.getFeatureSettingEnabled('plainTextViewPort') && document.contentType === 'text/plain') { + // text should span the full screen width + forcedValues.width = 'device-width' + // keep default scale to prevent text from appearing too small + forcedValues['initial-scale'] = 1 + } else if (!viewportTag || this.desktopModeEnabled) { // force wide viewport width forcedValues.width = screen.width >= 1280 ? 1280 : 980 forcedValues['initial-scale'] = (screen.width / forcedValues.width).toFixed(3)