Skip to content

Commit

Permalink
work for the #8209
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov committed May 29, 2024
1 parent 0b191c5 commit 4cb261b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ export class Question extends SurveyElement<Question>
this.updateCommentElements();
}
this.checkForResponsiveness(el);

if (this.isReadOnlyAttr) this.disableKeyboardForReadonlyQuestions(el);
}
public afterRenderCore(el: HTMLElement): void {
}
Expand Down Expand Up @@ -2556,6 +2558,21 @@ export class Question extends SurveyElement<Question>
this.resizeObserver.observe(el);
}
}

private disableKeyboardForReadonlyQuestions(el: HTMLElement) {
if (!el) return;
const inputs = el.querySelectorAll("input");
inputs.forEach((input)=>{
if (input) {
input.addEventListener("keydown", (e:any)=>{
if (e.key === "Tab") return;
e.preventDefault();
e.stopPropagation();
});
}
});
}

protected getCompactRenderAs(): string {
return "default";
}
Expand Down

0 comments on commit 4cb261b

Please sign in to comment.