Closed Bug 1997198 Opened 7 months ago Closed 4 months ago

Add moz-card to setting-group

Categories

(Firefox :: Settings UI, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
149 Branch
Tracking Status
firefox148 + fixed
firefox149 --- fixed

People

(Reporter: tgiles, Assigned: mstriemer)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp] [srdbb])

Attachments

(5 files)

The new Settings design feature a card container for each setting group. We should add moz-card to setting-group in order to achieve this. There are some open questions though:

  • Should we convert the <groupbox> -> <label> -> <h2|h1> elements into the <moz-card> heading or the <moz-fieldset> label?
    • startup-header
    • preferences-web-appearance-header
    • update-application-allow-description, not an <h2>, simply a <label>
    • performance-title, <h1>
    • browsing-title, <h1>
    • network-proxy-connection-description, a <span> within a <description>
    • sitedata-header
    • autofill-payment-methods-title
    • autofill-addresses-title
    • security-browsing-protection
    • httpsonly-header
    • There may be others but these were the ones I easily noticed
  • Should we address the "headings, labels, etc" as a follow-up task or tasks?
    • It would allow us to deliver an improvement to the current UI, as far as I can tell

Attaching a screenshot showing the "Startup" setting group with a moz-card wrapper. The following is a WIP patch that can be used to see what this change would bring:

diff --git a/browser/components/preferences/widgets/setting-group/setting-group.mjs b/browser/components/preferences/widgets/setting-group/setting-group.mjs
index 34d1374120b7..7a2552e9bc9a 100644
--- a/browser/components/preferences/widgets/setting-group/setting-group.mjs
+++ b/browser/components/preferences/widgets/setting-group/setting-group.mjs
@@ -112,15 +112,26 @@ export class SettingGroup extends MozLitElement {
     if (!this.config) {
       return "";
     }
-    return html`<moz-fieldset
-      data-l10n-id=${ifDefined(this.config.l10nId)}
-      .headingLevel=${this.config.headingLevel}
-      .supportPage=${ifDefined(this.config.supportPage)}
-      @change=${this.onChange}
-      @click=${this.onClick}
-      @visibility-change=${this.handleVisibilityChange}
-      >${this.config.items.map(item => this.itemTemplate(item))}</moz-fieldset
+    return html`<moz-card
+      ><moz-fieldset
+        data-l10n-id=${ifDefined(this.config.l10nId)}
+        .headingLevel=${this.config.headingLevel}
+        .supportPage=${ifDefined(this.config.supportPage)}
+        @change=${this.onChange}
+        @click=${this.onClick}
+        @visibility-change=${this.handleVisibilityChange}
+        >${this.config.items.map(item => this.itemTemplate(item))}</moz-fieldset
+      ></moz-card
     >`;
+    // return html`<moz-fieldset
+    //   data-l10n-id=${ifDefined(this.config.l10nId)}
+    //   .headingLevel=${this.config.headingLevel}
+    //   .supportPage=${ifDefined(this.config.supportPage)}
+    //   @change=${this.onChange}
+    //   @click=${this.onClick}
+    //   @visibility-change=${this.handleVisibilityChange}
+    //   >${this.config.items.map(item => this.itemTemplate(item))}</moz-fieldset
+    // >`;
   }
 }
 customElements.define("setting-group", SettingGroup);
Depends on: 1994888

Bug 1994888 is on file to convert the headings of the areas that are still relying on groupbox. If that's done then we shouldn't need to worry about headings here

One thing we should consider is that updating setting-group to use a card could lead to inconsistent UI when they're mixed with groupbox elements since those aren't using cards.

We do already have sub-panes being generated by setting-pane though, which could be a good candidate for when to enable the cards since they're on their own page and we only allow setting-group elements in there, we won't hit any inconsistency within that area.

This should be done behind the browser.settings-redesign.enabled pref for the main panes and right away for sub-panes

Whiteboard: [recomp] → [recomp] [srdbb]
Assignee: nobody → mstriemer
Pushed by csabou@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a8fdc928a8c1 https://hg.mozilla.org/integration/autoland/rev/83896b2c92b7 Revert "Bug 1997198 - Part 2: Trim leading on moz-fieldsets with headings r=desktop-theme-reviewers,tgiles" for causing mochitest failures on test_setting_group.

Backed out for causing several failures.

Push with failures

Failure logs:

Backout link

Flags: needinfo?(mstriemer)
Pushed by chorotan@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a02d8e0df2da https://hg.mozilla.org/integration/autoland/rev/7ba4ae8ea1a1 Revert "Bug 1997198 - Part 2: Trim leading on moz-fieldsets with headings r=desktop-theme-reviewers,tgiles" for causing ESlint failure

Backed out for causing ESlint failure and bc failures

Backout link

Push with failures

Failure log
Failure log bc
Failure log ss

Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch

[Tracking Requested - why for this release]: This is used in bug 2005804 to create the cards on the AI Controls page

I rebased this onto beta locally and it had a minor merge conflict but worked fine (doesn't automatically add cards since the patch that tells it to use cards isn't on beta, but that's fine, manually setting it worked). I'll rebase the stack from bug 2005804 (and others) onto this on beta when they hit central and put up a revision to uplift. There shouldn't be any issue with landing them separately though, so we could do that too

Blocks: 2005804
Flags: needinfo?(mstriemer)
Attachment #9540688 - Flags: approval-mozilla-beta?
Attachment #9540689 - Flags: approval-mozilla-beta?
Attachment #9540689 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9540688 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: