diff --git a/src/defaultCss/defaultV2Css.ts b/src/defaultCss/defaultV2Css.ts index 1f5fa3d320..56d40d45ff 100644 --- a/src/defaultCss/defaultV2Css.ts +++ b/src/defaultCss/defaultV2Css.ts @@ -238,6 +238,7 @@ export var defaultV2Css = { disabled: "sd-question--disabled", readOnly: "sd-question--readonly", preview: "sd-question--preview", + noPointerEventsMode: "sd-question--no-pointer-events", errorsContainer: "sd-element__erbox sd-question__erbox", errorsContainerTop: "sd-element__erbox--above-element sd-question__erbox--above-question", errorsContainerBottom: "sd-question__erbox--below-question" diff --git a/src/defaultV2-theme/blocks/sd-question.scss b/src/defaultV2-theme/blocks/sd-question.scss index 2b7f22c5ae..a802cb1aa9 100644 --- a/src/defaultV2-theme/blocks/sd-question.scss +++ b/src/defaultV2-theme/blocks/sd-question.scss @@ -2,6 +2,16 @@ position: relative; } +.sd-question--no-pointer-events { + + .sd-selectbase, + .sd-rating { + label { + pointer-events: none; + } + } +} + .sd-element__erbox--above-element { margin-bottom: calcSize(1); } diff --git a/src/question.ts b/src/question.ts index 33fd4d2cb9..9093946c2b 100644 --- a/src/question.ts +++ b/src/question.ts @@ -996,6 +996,7 @@ export class Question extends SurveyElement .append(cssClasses.hasErrorBottom, hasError && this.getErrorLocation() == "bottom") .append(cssClasses.small, !this.width) .append(cssClasses.answered, this.isAnswered) + .append(cssClasses.noPointerEventsMode, this.isReadOnlyAttr) .toString(); } public get cssHeader(): string { diff --git a/src/question_checkbox.ts b/src/question_checkbox.ts index 4907f79884..2e5cc33393 100644 --- a/src/question_checkbox.ts +++ b/src/question_checkbox.ts @@ -158,6 +158,7 @@ export class QuestionCheckboxModel extends QuestionCheckboxBase { this.renderedValue = val; } public clickItemHandler(item: ItemValue, checked?: boolean): void { + if (this.isReadOnlyAttr) return; if(item === this.selectAllItem) { if(checked === true || checked === false) { this.isAllSelected = checked; diff --git a/src/question_radiogroup.ts b/src/question_radiogroup.ts index 51647a9584..97609fbfc9 100644 --- a/src/question_radiogroup.ts +++ b/src/question_radiogroup.ts @@ -63,6 +63,7 @@ export class QuestionRadiogroupModel extends QuestionCheckboxBase { return !this.isDefaultV2Theme && this.canShowClearButton; } public clickItemHandler(item: ItemValue): void { + if (this.isReadOnlyAttr) return; this.renderedValue = item.value; }