Closed Bug 1966506 Opened 1 year ago Closed 9 months ago

Add support for disabling inputs based on a pref to config-based settings

Categories

(Firefox :: Settings UI, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: hjones, Assigned: mkennedy)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp])

Attachments

(1 file)

We need to introduce a way to disable and reenable inputs based on pref values to config-based settings.

The browserRestoreSession checkbox is disabled depending on the value of the browser.privatebrowsing.autostart pref, so could be a good candidate for replacement as part of the work on this feature.

Here's a preference configuration that could work for this case:

Preferences.addSetting({
  id: "browserRestoreSession",
  pref: "browser.startup.page",
  // add a function with the logic for whether or not the input should be disabled
  disabled: () => {
    // TODO: disabled logic goes here
  },
  ...
});

We'll then need to add logic to the Setting class to add a disabled getter that calls the disabled function and returns false by default (I imagine this will look pretty similar to the visible getter). There will be some additional work in the settings-control and settings-group elements to ensure disabled gets set on input elements.
Acceptance criteria:

  • it's possible to disable an input based on some preferences configuration
  • add tests to cover this
Blocks: 1966542

I think this should be done after bug 1966542. Related settings will likely be useful here and we should consider how we can easily pass those to the disabled function to check if it should be disabled

Preferences.addSetting({
  id: "browserRestoreSession",
  pref: "browser.startup.page",
  deps: ["permanentPrivateBrowsing"],
  // add a function with the logic for whether or not the input should be disabled
  // deps comes from bug 1966542, the API will be defined in that ticket
  disabled: deps => deps.permanentPrivateBrowsing.value,
  ...
});
No longer blocks: 1966542
Depends on: 1966542
Assignee: nobody → mkennedy

Depends on https://phabricator.services.mozilla.com/D257555 and I'm still
adding tests, but just wanted to open this up for early review.

Pushed by mkennedy@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/031f33f158ae https://hg.mozilla.org/integration/autoland/rev/4a0b15ff1b74 Add support for disabling inputs based on a pref to config-based settings r=reusable-components-reviewers,settings-reviewers,mconley,mstriemer
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch
QA Whiteboard: [qa-triage-done-c144/b143]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: