Closed Bug 1727601 Opened 3 years ago Closed 3 years ago

Use l10n cache for strings in the urlbar view

Categories

(Firefox :: Address Bar, task, P3)

task
Points:
3

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: adw, Assigned: lesore0789, Mentored)

References

Details

Attachments

(5 files)

While working on the Firefox Suggest label pop-in/flicker problem in bug 1725289, I noticed that our other l10n strings in the view pop in too. Their pop-in is harder to spot because unlike the Firefox Suggest label, they don't cause the view to get taller or shift any results when they pop in. Even so, it still contributes to an overall feeling of flicker and instability in the view IMO, and ideally it wouldn't happen.

I'll attach some screenshots that show the problem.

It should be straightforward to use the string caching mechanism added in that bug for all l10n strings in the view.

The search heuristic is still showing the Visit string after I typed "ded". A split second later it changes to Search with Google.

The tab-to-search result is missing its title. A split second later "Search with DuckDuckGo --" pops in.

Amazon and eBay are both sponsored results. Amazon's action text is still the search heuristic action, and eBay's is missing. A split second later, "Sponsored" pops in for both results.

The visit heuristic action is still Sponsored, after showing Amazon and eBay from the previous screenshot and then typing "d". A split second later it changes to Visit.

Severity: -- → N/A

Drew, I wonder if you'd be interested in mentoring this?

Flags: needinfo?(adw)

Yes, but I'd like to fix this sooner rather than later, so I might end up taking it.

Mentor: adw
Flags: needinfo?(adw)

Hi Drew, my name is Leslie and I am an Outreachy applicant. I would like to work on this bug. Can I be assigned to it?

Flags: needinfo?(adw)

Hi Drew, I just wanted to follow up on this bug. I'd like to work on it, but I have questions regarding where to start. What files should I be working on?

Hi Leslie, basically the idea is to update UrlbarView to replace all this.document.l10n.setAttributes calls with calls to this._setElementL10n. There are already to calls to _setElementL10n in that file, so you can look at those for examples on how to call it.

Some of those calls have corresponding calls to element.removeAttribute("data-l10n-id") when the UI label needs to be removed, and those removeAttribute calls need to be updated to this._removeElementL10n.

Before you can use cached strings with _setElementL10n, you'll first need to cache them by adding them to _cacheL10nStrings.

This document on Fluent might be helpful to look at to understand what's going on with these calls, at least the first half, not so much the second half.

Flags: needinfo?(adw)
Assignee: nobody → lesore0789
Status: NEW → ASSIGNED
Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b28a6727c326
Use l10n cache for strings in the urlbar view. r=adw
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
See Also: → 1749290
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: