tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d19bad8fc53d1777c5382957490ccc6a72b94926
parent d36575cee4021fcecb68613666d6b7ddf43edfcc
Author: Jeff Boek <j@jboek.com>
Date:   Tue, 11 Nov 2025 22:02:33 +0000

Bug 1997575 - Implements a webcompat intervention for Perplexity r=webcompat-reviewers,twisniewski

Differential Revision: https://phabricator.services.mozilla.com/D271710

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 18++++++++++++++++++
Abrowser/extensions/webcompat/injections/js/1997575-perplexity.ai-covered-fixed-element.js | 31+++++++++++++++++++++++++++++++
Mbrowser/extensions/webcompat/manifest.json | 2+-
Atesting/webcompat/interventions/tests/test_1997575_perplexity_ai.py | 33+++++++++++++++++++++++++++++++++
4 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -5984,5 +5984,23 @@ } } ] + }, + "1997575": { + "label": "perplexity.ai", + "bugs": { + "1997575": { + "issue": "user-interface-frustration", + "matches": ["*://www.perplexity.ai/*"] + } + }, + "interventions": [ + { + "platforms": ["android"], + "content_scripts": { + "all_frames": true, + "js": ["1997575-perplexity.ai-covered-fixed-element.js"] + } + } + ] } } diff --git a/browser/extensions/webcompat/injections/js/1997575-perplexity.ai-covered-fixed-element.js b/browser/extensions/webcompat/injections/js/1997575-perplexity.ai-covered-fixed-element.js @@ -0,0 +1,31 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/** + * Bug 1997575 - Perplexity toolbar hides behind the keyboard + * + * Dynamic toolbar in Firefox for Android is covering the input field in Perplexity. + */ + +/* globals exportFunction */ + +console.info( + "interactive-widget is being applied for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1997575 for details." +); + +document.addEventListener("DOMContentLoaded", () => { + let metaViewport = document.querySelector("meta[name=viewport]"); + if (!metaViewport) { + return; + } + let content = metaViewport.content; + if (!content.includes("interactive-widget")) { + metaViewport.setAttribute( + "content", + content + ",interactive-widget=resizes-content" + ); + } +}); diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Web Compatibility Interventions", "description": "Urgent post-release fixes for web compatibility.", - "version": "147.0.0", + "version": "147.1.0", "browser_specific_settings": { "gecko": { "id": "webcompat@mozilla.org", diff --git a/testing/webcompat/interventions/tests/test_1997575_perplexity_ai.py b/testing/webcompat/interventions/tests/test_1997575_perplexity_ai.py @@ -0,0 +1,33 @@ +import pytest + +URL = "https://perplexity.ai?pc=firefox&q=firefox" +ASK_INPUT_CSS = "#ask-input" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + + viewport = client.execute_script( + "return document.querySelector('meta[name=viewport]').content" + ) + + assert ( + viewport + == "width=device-width,initial-scale=1,interactive-widget=resizes-content" + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + + viewport = client.execute_script( + "return document.querySelector('meta[name=viewport]').content" + ) + + assert viewport == "width=device-width,initial-scale=1"