From 087ca9280429529f7763b318fecccdc91605fb50 Mon Sep 17 00:00:00 2001 From: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com> Date: Tue, 28 Feb 2023 12:03:09 -0500 Subject: [PATCH] Disabled widgets checkbox if manifest doesn't have widgets (#3876) fixes #3873 ## PR Type Feature ## Describe the current behavior? If you didn't have widgets, you were still able to check the box in the windows form saying to serve widgets for your package which changes the way the .msix is built unnecessarily. ## Describe the new behavior? You can only toggle the widgets checkbox if you already have widgets in your manifest. Otherwise, it'll be disabled. ## PR Checklist - [x] Test: run `npm run test` and ensure that all tests pass - [x] Target main branch (or an appropriate release branch if appropriate for a bug fix) - [x] Ensure that your contribution follows [standard accessibility guidelines](https://docs.microsoft.com/en-us/microsoft-edge/accessibility/design). Use tools like https://webhint.io/ to validate your changes. ## Additional Information --- .../src/script/components/app-package-form-base.ts | 6 ++++++ apps/pwabuilder/src/script/components/windows-form.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/apps/pwabuilder/src/script/components/app-package-form-base.ts b/apps/pwabuilder/src/script/components/app-package-form-base.ts index 751be0e2e..4df4c5357 100644 --- a/apps/pwabuilder/src/script/components/app-package-form-base.ts +++ b/apps/pwabuilder/src/script/components/app-package-form-base.ts @@ -131,6 +131,10 @@ export class AppPackageFormBase extends LitElement { border: 1px solid var(--error-color); } + input:disabled { + cursor: no-drop; + } + @media (min-height: 760px) and (max-height: 1000px) { form { @@ -180,6 +184,7 @@ export class AppPackageFormBase extends LitElement { max="${ifDefined(formInput.maxValue)}" pattern="${ifDefined(formInput.pattern)}" spellcheck="${ifDefined(formInput.spellcheck)}" ?checked="${formInput.checked}" ?readonly="${formInput.readonly}" custom-validation-error-message="${ifDefined(formInput.validationErrorMessage)}" + ?disabled=${formInput.disabled} @input="${(e: UIEvent) => this.inputChanged(e, formInput)}" @invalid=${this.inputInvalid} /> `; } @@ -284,5 +289,6 @@ export interface FormInput { readonly?: boolean; validationErrorMessage?: string; checked?: boolean; + disabled?: boolean; inputHandler?: (val: string, checked: boolean, input: HTMLInputElement) => void; } \ No newline at end of file diff --git a/apps/pwabuilder/src/script/components/windows-form.ts b/apps/pwabuilder/src/script/components/windows-form.ts index fe586d791..c67a74418 100644 --- a/apps/pwabuilder/src/script/components/windows-form.ts +++ b/apps/pwabuilder/src/script/components/windows-form.ts @@ -499,6 +499,7 @@ export class WindowsForm extends AppPackageFormBase { inputId: 'widget-checkbox', type: 'checkbox', checked: this.packageOptions.enableWebAppWidgets, + disabled: !this.packageOptions.enableWebAppWidgets, inputHandler: (_val: string, checked: boolean) => (this.packageOptions.enableWebAppWidgets = checked), })}