Closed Bug 2046503 Opened 3 months ago Closed 5 days ago

Widgets listed in about:preferences should be dynamically rendered from WidgetsRegistry.mjs

Categories

(Firefox :: New Tab Page, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: maxx, Assigned: nina-py)

References

(Blocks 1 open bug)

Details

(Whiteboard: [hnt][hnt-wattle])

Attachments

(1 file)

No description provided.

The widget list in about:preferences#home is hardcoded. AboutPreferences.sys.mjs declares each widget's row by hand in the Widgets group's items array, plus a matching pair of Preferences.addSetting() calls per widget — duplicating what WIDGET_REGISTRY in WidgetsRegistry.mjs already knows. Adding a widget means editing three places, and missing any of them means it silently never appears in preferences. There's a // Bug 2046503 marker in the tree at the spot.

Generate the group's items and their addSetting() registrations by iterating WIDGET_REGISTRY instead.

One gap: registry entries carry no Fluent id, so labels can't be derived as-is. Adding a label field is likely part of this. Note that about:preferences and the newtab customize panel use different ids for the same widget (home-prefs-clocks-header vs newtab-custom-widget-clock-toggle), so one l10nId field won't serve both without a per-surface mapping. Separately, WIDGET_REGISTRY.order is page-placement order (user-draggable, trainhop-overridable) and isn't preferences-list order.

Acceptance criteria

  • Widgets group items and the per-widget addSetting() pairs are generated from WIDGET_REGISTRY; no per-widget literals remain in AboutPreferences.sys.mjs.
  • Adding a registry entry makes its toggle appear with no change to AboutPreferences.sys.mjs. Covered by a test using a fixture widget.
  • Visibility unchanged — still resolved via isWidgetToggleVisible() / isWidgetAddable(), covering the system pref, legacy widgetsConfig, trainhopConfig.widgets.*, widgetsSettings.*Visible, and trainhopNamespace.visible. Namespace path verified for Picture of the Day and Crossword.
  • Weather's dual placement preserved: nested in the Widgets group when the container is shown, standalone top-level moz-toggle when the container is off but Weather is enabled.
  • firefoxHomeActive disabled state and subcategory attributes preserved (the latter keeps preferences search and deep links working).
  • No user-visible change: for any given pref and Nimbus state, the rows shown, their labels, and their controls are identical before and after. Row order may change only as a consequence of bug 2066334.
    Related

Bug 2066334 requires this list sorted A-Z by localized label. Please review before picking an order for the generated list.

Summary: Widgets listed on about:preferences#home should be dynamically rendered from WidgetsRegistry.mjs → Widgets listed in about:preferences should be dynamically rendered from WidgetsRegistry.mjs
Whiteboard: [hnt][hnt-wattle]
Assignee: nobody → mcrawford
Assignee: mcrawford → nobody
Assignee: nobody → npypchenko

The Firefox Home > Widgets group in about:preferences is now generated from
WIDGET_REGISTRY instead of being written out widget by widget. Each registry
entry gained a prefsL10nId naming its label, and that is all a new widget
needs to appear there; a retired widget disappears on its own.

Weather keeps a small hand-written part: with Nova off its toggle still uses
the legacy weather prefs, and it is the one widget that can sit outside the
Widgets group as its own row. The legacy branch is marked for Nova cleanup.

One visible change: the checkboxes now follow registry order, the same order
New Tab uses by default, Weather included. Two setting ids changed under the
hood, the Timer toggle's from timer to its registry id focusTimer and
Weather's own row to weatherStandalone, leaving weather for its checkbox
inside the group; the preferences mochitests were updated to match.

Pushed by npypchenko@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c3ce3bf0c5ce https://hg.mozilla.org/integration/autoland/rev/8abe9f7e2ae1 Widgets listed in about:preferences should be dynamically rendered from WidgetsRegistry.mjs r=maxx
Status: NEW → RESOLVED
Closed: 5 days ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
QA Whiteboard: [qa-triage-done-c159/b158]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: