Sort newtab widget lists alphabetically
Categories
(Firefox :: New Tab Page, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: gharp, Assigned: nina-py)
References
Details
(Whiteboard: [hnt][hnt-wattle])
Attachments
(2 files)
The widget toggle lists in about:preferences (Firefox Home -> Widgets) and in the newtab customize panel ("Manage widgets") are both in a non-sensical order, and they don't match each other.
Both lists should be sorted A-Z by the widget's localized display label, using locale-aware collation; a French user should see the list sorted for French rather than sorted by the en-US string or by internal widget id. Weather is included as a peer of the other widgets, not held out separately.
Current order:
- about:preferences (
AboutPreferences.sys.mjs): Lists, Timer, Sports, Clock, Privacy, Crossword, Stocks, Picture of the day, Weather - Customize panel (
WidgetsManagementPanel.jsx): Weather, Timer, Lists, Sports, Clock, Privacy, Crossword, Stocks, Picture of the day
Widget availability
Not every widget is available to every user. Availability is gated per-user by system prefs and Nimbus/trainhop config, which is targeted by region among other things, and most widgets default to off entirely today. A user in one country may see a very different set than a user in another.
Acceptance criteria
- In about:preferences -> Firefox Home -> Widgets, the visible widget toggles render in A-Z order by displayed label, Weather included.
- In the newtab customize panel -> Manage widgets, the visible widget toggles render in A-Z order by displayed label.
- Sorting is locale-aware and operates on the localized string, not the widget id, pref name, or en-US label. Verified in at least one non-English locale with accents or a different alphabet.
- Availability filtering is unchanged, and the sorted list is contiguous when only a subset of widgets is available.
- Order is stable across page loads, and unaffected by which widgets the user has toggled on.
- Both surfaces show the same relative order for any given locale.
- Test coverage on both surfaces, including a reduced widget set and the addition of a new widget.
QA note: Weather already happens to sort last in en-US, so en-US alone won't catch a Weather placement bug. Test a locale where it doesn't.
Notes for implementation
- Labels come from Fluent, so the sort key isn't available at list-construction time. Worth avoiding a visible reorder flash on open.
- The two surfaces use different Fluent ids for the same widget, e.g.
home-prefs-clocks-headervsnewtab-custom-widget-clock-toggle. WIDGET_REGISTRYhas anorderfield, but it is page-placement order (user-draggable, trainhop-overridable) and shouldn't be repurposed for list order.- Bug 2046503 covers generating the about:preferences widget list dynamically from
WidgetsRegistry.mjs. Landing that first would make most of this free.
Out of scope
- Widget layout order on the newtab page itself (placement and drag-and-drop).
- Which widgets are available to which users.
- Widget labels and strings.
- Grouping, sectioning, or search within the lists.
Updated•1 month ago
|
| Reporter | ||
Updated•1 month ago
|
| Assignee | ||
Updated•10 days ago
|
| Assignee | ||
Comment 1•9 days ago
|
||
The Manage widgets list in the New Tab customize panel is now generated from
WIDGET_REGISTRY instead of being written out toggle by toggle. Each registry
entry gained a customizeL10nId naming its panel label and a
customizeEventSource carrying its telemetry source, so a new widget needs no
edit to the panel and a retired widget drops out on its own. Crossword gained
a Fluent string of its own for the first time; a migration recipe copies its
translations from the about:preferences Crossword label, and the classic
customize menu switched to the same string.
The classic (Nova off) customize menu still renders its own widget toggles from
the mayHave* and enabledWidgets props, so that prop chain stayed and has
been marked for Nova cleanup; only its retired Sports links were removed. The
check that decides whether Weather may be shown moved out of Base.jsx into the
registry as isWeatherAvailable, where the panel shares it.
Telemetry is unchanged: the generated toggles carry the same event sources and
pref names as before, and the outer Widgets toggle records the same events for
a flip as it did. Part 2 will sort both this list and the about:preferences
group alphabetically; until it lands, the panel lists widgets in registry
order. Three toggle ids changed to their registry ids (focusTimer-toggle,
pictureOfTheDay-toggle, recentSearches-toggle), and the browser test now
finds the Weather toggle by its own id.
| Assignee | ||
Comment 2•9 days ago
|
||
Both widget toggle lists now sort A-Z by the label the user sees, in the app
locale: the Firefox Home > Widgets group in about:preferences and the
"Manage widgets" subpanel of the New Tab customize panel. Part 1 put both
lists in registry order; this patch replaces that with an order users can
scan.
Each surface sorts by its own strings. The about:preferences labels and
the customize panel labels are separate string sets, kept so that either
can be retired later, so a locale that translated the two sets differently
can order the two lists differently; in en-US they agree. The comparison is
localeCompare with no arguments, which collates in the app locale on both
surfaces, and a label with no message sorts under its widget id, so the
order is always defined.
Setting registration order and the standalone Weather row are unchanged;
nested Weather sorts among the other widgets. The "Manage widgets" subpanel
renders no toggles until its labels have resolved, which happens when the
page loads and before the subpanel can be opened, so an unsorted list is
never shown. Tests on both surfaces pin hand-written orders for English,
German, Greek and Japanese labels taken from Firefox's own translations,
plus a reduced set, a missing label and a failing lookup.
Comment 4•5 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/ba723c91bdea
https://hg.mozilla.org/mozilla-central/rev/ac08d6cbc9b7
Description
•