Closed Bug 1901191 Opened 1 year ago Closed 1 year ago

Markup for privacy preserving attribution is using moz-support-link in an unintended way

Categories

(Firefox :: Settings UI, task)

task

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: flod, Assigned: flod)

References

Details

Attachments

(1 file, 1 obsolete file)

The markup includes a moz-support-link within the description, but that's removed by Fluent when applying the message, since the anchor is not a text-level element.

Assignee: nobody → francesco.lodolo
Status: NEW → ASSIGNED

Can you elaborate? It seems to be preserved properly here, here's what I see on the inspector:

<description xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="indent tip-caption" data-l10n-id="website-advertising-private-attribution-description">This helps sites understand how their ads perform without collecting data about you. <html:a xmlns:html="http://www.w3.org/1999/xhtml" is="moz-support-link" class="learnMore" data-l10n-name="learn-more" support-page="privacy-preserving-attribution" href="https://support.mozilla.org/1/firefox/128.0a1/Darwin/en-US/privacy-preserving-attribution" target="_blank">Learn More</html:a></description>

Which looks right? Note the l10n-name stuff which should make it be preserved

Assignee: francesco.lodolo → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(francesco.lodolo)
Assignee: nobody → francesco.lodolo
Status: NEW → ASSIGNED

(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)

Can you elaborate? It seems to be preserved properly here, here's what I see on the inspector:

The anchor in the Fluent message is preserved, but the whole point of the moz-support-link component is to not have the learn more link explicitly defined in the message.

Right now, the moz-support-link in your code is not used at all.

Flags: needinfo?(francesco.lodolo)

It is tho, right? Where does the href come from otherwise?

In the hurry to find a fix, I provided a very poor analysis/explanation of the problem.

The current patch works, but it's adding unnecessary markup to the Fluent message that moz-support-link is designed to avoid.

website-advertising-private-attribution-description = This helps sites understand how their ads perform without collecting data about you. <a data-l10n-name="learn-more">Learn More</a>

I initially thought that this should create a duplicate link, but it isn't. Then I realized that the moz-support-link element is placed within the <description>, and assumed one of the links would be removed by Fluent at run-time. Instead, it's working because you're manually assigning the data-l10n-name to the anchor created by moz-support-link, so the anchor is preserved by DOM overlays.

    <html:a is="moz-support-link"
            class="learnMore"
            data-l10n-name="learn-more"
            support-page="privacy-preserving-attribution"/>

The correct approach with moz-support-link is to have it create the link, including the label. But for that to work, it needs to be outside of the element to which you're applying the Fluent message (otherwise, it will be removed by DOM overlays).

<description class="indent tip-caption">
    <html:span data-l10n-id="website-advertising-private-attribution-description" />
    <html:a is="moz-support-link"
            class="learnMore"
            support-page="privacy-preserving-attribution"/>
  </description>
Type: defect → task
Summary: Markup for privacy preserving attribution is incorrect → Markup for privacy preserving attribution is using moz-support-link in an unintended way
Attachment #9406049 - Attachment description: Bug 1901191 - Fix use of moz-support-link in privacy-preserving setting, r=emilio! → Bug 1901191 - Tweak use of moz-support-link in privacy-preserving setting, r=emilio!
No longer depends on: 1901194
Pushed by flodolo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/91916bcb1740 Tweak use of moz-support-link in privacy-preserving setting, r=emilio,settings-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: