Closed Bug 2011465 Opened 10 months ago Closed 10 months ago

Dismissing privacy warning leaves empty box in new privacy settings

Categories

(Firefox :: Settings UI, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 2005804

People

(Reporter: valentin, Unassigned)

References

Details

Attachments

(1 file)

STR:

  • Disable Firefox password manager (or tell it not to prompt for passwords. I use Bitwarden).
  • Set browser.settings-redesign.enabled to true
  • Go to about:preferences#privacy
  • Dismiss warning in securityPrivacyWarnings related to password manager

Result:

Empty box that previously contained the warnings remains on the page.

Attached image image.png —

This appears to be a consequence of frontend adding style to setting groups.

@hannah: The two boxes in the screenshot here are a little special. One because Kit aligns to the top of the box, and the second because it is collapsable, so I was hoping to have the items within the setting group control the card. Is there a way to drop the card styling from these or a bug to track it?

Flags: needinfo?(hjones)

hmm yeah so I expect this was caused by bug 1997198 which introduced the card wrappers around. This is kinda expected/intentional - I think we may just need to make some limited changes to the security/privacy code. I'm not sure about adding these attributes to the moz-card in settings-group, but something like this seems to work locally:

diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index b736813a48ec..bffe1648238c 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -2867,23 +2867,15 @@ SettingGroupManager.registerGroups({
   },
   securityPrivacyWarnings: {
     inProgress: true,
+    cardType: "accordion",
+    cardl10nId: "security-privacy-issue-card",
     items: [
       {
-        id: "warningCard",
-        l10nId: "security-privacy-issue-card",
-        control: "moz-card",
+        id: "securityWarningsGroup",
+        control: "moz-box-group",
         controlAttrs: {
-          type: "accordion",
+          type: "list",
         },
-        items: [
-          {
-            id: "securityWarningsGroup",
-            control: "moz-box-group",
-            controlAttrs: {
-              type: "list",
-            },
-          },
-        ],
       },
     ],
   },
diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js
index 57d67b7a4a13..c30f396f3f29 100644
--- a/browser/components/preferences/privacy.js
+++ b/browser/components/preferences/privacy.js
@@ -1371,6 +1371,17 @@ if (SECURITY_PRIVACY_STATUS_CARD_ENABLED) {
   Preferences.addSetting(
     /** @type {{ makeSecurityWarningItems: () => SettingControlConfig[] } & SettingConfig} */ ({
       id: "securityWarningsGroup",
+      deps: SECURITY_WARNINGS.map(warning => warning.id),
+      visible: deps => {
+        const count = Object.values(deps).filter(
+          depSetting => depSetting.visible
+        ).length;
+        if (!this._telemetrySent) {
+          Glean.securityPreferencesWarnings.warningsShown.record({ count });
+          this._telemetrySent = true;
+        }
+        return count > 0;
+      },
       makeSecurityWarningItems() {
         return SECURITY_WARNINGS.map(({ id, l10nId }) => ({
           id,
@@ -1414,20 +1425,6 @@ if (SECURITY_PRIVACY_STATUS_CARD_ENABLED) {
     ],
   });
 
-  Preferences.addSetting({
-    id: "warningCard",
-    deps: SECURITY_WARNINGS.map(warning => warning.id),
-    visible: deps => {
-      const count = Object.values(deps).filter(
-        depSetting => depSetting.visible
-      ).length;
-      if (!this._telemetrySent) {
-        Glean.securityPreferencesWarnings.warningsShown.record({ count });
-        this._telemetrySent = true;
-      }
-      return count > 0;
-    },
-  });
 }
 
 Preferences.addSetting({
diff --git a/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs b/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs
index cafaeaf64908..057dd3eb77dc 100644
--- a/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs
+++ b/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs
@@ -289,22 +289,20 @@ export default class SecurityPrivacyCard extends MozLitElement {
         rel="stylesheet"
         href="chrome://browser/content/preferences/widgets/security-privacy-card.css"
       />
-      <moz-card aria-labelledby="heading">
-        <div class="card-contents">
-          <div class="status-text-container">
-            <h3
-              id="heading"
-              data-l10n-id=${headerL10nId}
-              data-l10n-args=${JSON.stringify(headerL10nData)}
-            ></h3>
-            <ul>
-              ${this.buildIssuesElement()} ${this.buildTrackersElement()}
-              ${this.buildUpdateElement()}
-            </ul>
-          </div>
-          ${this.getStatusImage()}
+      <div class="card-contents">
+        <div class="status-text-container">
+          <h3
+            id="heading"
+            data-l10n-id=${headerL10nId}
+            data-l10n-args=${JSON.stringify(headerL10nData)}
+          ></h3>
+          <ul>
+            ${this.buildIssuesElement()} ${this.buildTrackersElement()}
+            ${this.buildUpdateElement()}
+          </ul>
         </div>
-      </moz-card>
+        ${this.getStatusImage()}
+      </div>
     `;
   }
 }
diff --git a/browser/components/preferences/widgets/setting-group/setting-group.mjs b/browser/components/preferences/widgets/setting-group/setting-group.mjs
index f1ef68d06d58..f75353e8b72b 100644
--- a/browser/components/preferences/widgets/setting-group/setting-group.mjs
+++ b/browser/components/preferences/widgets/setting-group/setting-group.mjs
@@ -2,7 +2,7 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-import { html } from "chrome://global/content/vendor/lit.all.mjs";
+import { html, ifDefined } from "chrome://global/content/vendor/lit.all.mjs";
 import {
   SettingElement,
   spread,
@@ -167,7 +167,11 @@ export class SettingGroup extends SettingElement {
    */
   containerTemplate(content) {
     if (this.srdEnabled || this.inSubPane) {
-      return html`<moz-card>${content}</moz-card>`;
+      return html`<moz-card
+        type=${ifDefined(this.config.cardType)}
+        data-l10n-id=${ifDefined(this.config.cardl10nId)}
+        >${content}</moz-card
+      >`;
     }
     return content;
   }
Flags: needinfo?(hjones)

alternatively if we're cool with making the accordion card a follow up for post-MVP settings redesign, we could just do this:

diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index b736813a48ec..eea78f4b7851 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -2867,23 +2867,14 @@ SettingGroupManager.registerGroups({
   },
   securityPrivacyWarnings: {
     inProgress: true,
+    l10nId: "security-privacy-issue-card",
     items: [
       {
-        id: "warningCard",
-        l10nId: "security-privacy-issue-card",
-        control: "moz-card",
+        id: "securityWarningsGroup",
+        control: "moz-box-group",
         controlAttrs: {
-          type: "accordion",
+          type: "list",
         },
-        items: [
-          {
-            id: "securityWarningsGroup",
-            control: "moz-box-group",
-            controlAttrs: {
-              type: "list",
-            },
-          },
-        ],
       },
     ],
   },
diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js
index 57d67b7a4a13..c30f396f3f29 100644
--- a/browser/components/preferences/privacy.js
+++ b/browser/components/preferences/privacy.js
@@ -1371,6 +1371,17 @@ if (SECURITY_PRIVACY_STATUS_CARD_ENABLED) {
   Preferences.addSetting(
     /** @type {{ makeSecurityWarningItems: () => SettingControlConfig[] } & SettingConfig} */ ({
       id: "securityWarningsGroup",
+      deps: SECURITY_WARNINGS.map(warning => warning.id),
+      visible: deps => {
+        const count = Object.values(deps).filter(
+          depSetting => depSetting.visible
+        ).length;
+        if (!this._telemetrySent) {
+          Glean.securityPreferencesWarnings.warningsShown.record({ count });
+          this._telemetrySent = true;
+        }
+        return count > 0;
+      },
       makeSecurityWarningItems() {
         return SECURITY_WARNINGS.map(({ id, l10nId }) => ({
           id,
@@ -1414,20 +1425,6 @@ if (SECURITY_PRIVACY_STATUS_CARD_ENABLED) {
     ],
   });
 
-  Preferences.addSetting({
-    id: "warningCard",
-    deps: SECURITY_WARNINGS.map(warning => warning.id),
-    visible: deps => {
-      const count = Object.values(deps).filter(
-        depSetting => depSetting.visible
-      ).length;
-      if (!this._telemetrySent) {
-        Glean.securityPreferencesWarnings.warningsShown.record({ count });
-        this._telemetrySent = true;
-      }
-      return count > 0;
-    },
-  });
 }
 
 Preferences.addSetting({
diff --git a/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs b/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs
index cafaeaf64908..057dd3eb77dc 100644
--- a/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs
+++ b/browser/components/preferences/widgets/security-privacy/security-privacy-card/security-privacy-card.mjs
@@ -289,22 +289,20 @@ export default class SecurityPrivacyCard extends MozLitElement {
         rel="stylesheet"
         href="chrome://browser/content/preferences/widgets/security-privacy-card.css"
       />
-      <moz-card aria-labelledby="heading">
-        <div class="card-contents">
-          <div class="status-text-container">
-            <h3
-              id="heading"
-              data-l10n-id=${headerL10nId}
-              data-l10n-args=${JSON.stringify(headerL10nData)}
-            ></h3>
-            <ul>
-              ${this.buildIssuesElement()} ${this.buildTrackersElement()}
-              ${this.buildUpdateElement()}
-            </ul>
-          </div>
-          ${this.getStatusImage()}
+      <div class="card-contents">
+        <div class="status-text-container">
+          <h3
+            id="heading"
+            data-l10n-id=${headerL10nId}
+            data-l10n-args=${JSON.stringify(headerL10nData)}
+          ></h3>
+          <ul>
+            ${this.buildIssuesElement()} ${this.buildTrackersElement()}
+            ${this.buildUpdateElement()}
+          </ul>
         </div>
-      </moz-card>
+        ${this.getStatusImage()}
+      </div>
     `;
   }
 }
diff --git a/browser/locales-preview/privacyPreferences.ftl b/browser/locales-preview/privacyPreferences.ftl
index 5a7b4dc6c2b6..b50dfbc740d0 100644
--- a/browser/locales-preview/privacyPreferences.ftl
+++ b/browser/locales-preview/privacyPreferences.ftl
@@ -38,7 +38,7 @@ security-privacy-image-ok =
   .alt = The { -brand-short-name } mascot, pleased that you have no outstanding security issues
 
 security-privacy-issue-card =
-  .heading = Security warnings
+  .label = Security warnings
 issue-card-reset-button =
   .label = Fix
 issue-card-dismiss-button =

I'm okay with either approach, depending on how you want to prioritize for MVP.

I think this will be fixed by bug 2005804, we had a similar situation on the AI Controls, some groups need a card, some can't have a card, and there was a section that had a nested "visible" input which was causing it to take up space like this. Seems correct for me when its hidden locally

See Also: → 2005804

This was fixed by Bug 2005804

Status: NEW → RESOLVED
Closed: 10 months ago
Duplicate of bug: 2005804
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: