diff --git a/src/app/shared/btn-disabled.directive.ts b/src/app/shared/btn-disabled.directive.ts index 427d1654da0..bbc21fef7f8 100644 --- a/src/app/shared/btn-disabled.directive.ts +++ b/src/app/shared/btn-disabled.directive.ts @@ -59,5 +59,19 @@ export class BtnDisabledDirective { event.stopImmediatePropagation(); } } + + /** + * Prevents the default action and stops the event from propagating when the element is disabled. + * Some controls (e.g. dropdown options) commit on mousedown rather than click, so a disabled + * element must ignore mousedown as well to stay non-interactive. + * @param event The mousedown event. + */ + @HostListener('mousedown', ['$event']) + handleMousedown(event: Event) { + if (this.isDisabled) { + event.preventDefault(); + event.stopImmediatePropagation(); + } + } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.html index be852fbcbcc..eb523d91c58 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.html @@ -49,6 +49,7 @@