Closed Bug 1901351 Opened 5 months ago Closed 5 months ago

Do not offer SelectTranslations Translate Link Text menu item for URLs

Categories

(Firefox :: Translations, enhancement, P3)

Desktop
All
enhancement

Tracking

()

VERIFIED FIXED
129 Branch
Tracking Status
firefox128 --- verified
firefox129 --- verified

People

(Reporter: nordzilla, Assigned: nordzilla)

References

Details

Attachments

(2 files)

Description

There are many cases in which the "Translate Link Text" option for the Select Translations Panel will be for a URL, rather than plain text that is hyperlinked.

If the linked text is verified to be just a URL, we should not offer to translate, because any translation on the URL would most likely yield an invalid URL.

If the user manually selects a URL, however, and choose to translate their active selection, rather than right clicking linked text, then we will still translate their selection regardless.


Steps to implement


Tests to implement

  • Write a test that ensures that the menu item is not available when right clicking link text that is a just a URL.

This patch ensures that the Translate Link Text
option is not offered in the context menu when
right clicking hyperlinked text that would result
in translating a only a URL being translated.

Attachment #9406206 - Attachment description: WIP: Bug 1901351 - Do not offer Translate Link Text for URLs r=#translations-reviewers! → Bug 1901351 - Do not offer Translate Link Text for URLs r=#translations-reviewers!
Attachment #9406206 - Attachment description: Bug 1901351 - Do not offer Translate Link Text for URLs r=#translations-reviewers! → Bug 1901351 - Do not offer Translate Link Text for URLs r=#translations-reviewers!,ohall
Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a3650bda33a8 Do not offer Translate Link Text for URLs r=translations-reviewers,ohall

Backed out for causing bc failures in browser_contextmenu.js

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | browser/base/content/test/contextMenu/browser_contextmenu.js | checking item #14 (context-translate-selection) name - Got "---", expected "context-translate-selection"
Flags: needinfo?(enordin)

UPDATE

I ran the Translations test suite in try, but I forgot to check the general context-menu tests, which caused a failure.

I've now updated the relevant general context-menu tests.

Flags: needinfo?(enordin)
Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7b0e142ae4c1 Do not offer Translate Link Text for URLs r=translations-reviewers,ohall
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch

This patch ensures that the Translate Link Text
option is not offered in the context menu when
right clicking hyperlinked text that would result
in only a URL being translated.

Original Revision: https://phabricator.services.mozilla.com/D212980

Attachment #9407741 - Flags: approval-mozilla-beta?
Attachment #9407741 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: in-testsuite+

I can reproduce this issue in Nightly v129.0a1 from 2024-06-10; I can confirm the fix in Nightly v129.0a1 from 2024-06-20 and Beta v128.0b5. The plain URL links (hyperlinks without representation text) no longer offer the option to translate in context menu. Closing as verified.

Status: RESOLVED → VERIFIED
OS: Unspecified → All
Hardware: Unspecified → Desktop
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: