From 56e91aff5a21b9615b7a8c7b2d594b68227b36c8 Mon Sep 17 00:00:00 2001 From: Aurora Virmasalo Date: Tue, 3 Sep 2024 10:18:57 +0300 Subject: [PATCH 1/4] Fix examination question hide button accessibility --- .../exam-participation.component.html | 4 +-- .../sections/section-question.component.html | 12 ++----- .../examination-question.component.html | 33 +++++++++++-------- .../examination-question.component.ts | 5 +++ 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/ui/src/app/enrolment/finished/exam-participation.component.html b/ui/src/app/enrolment/finished/exam-participation.component.html index 362716eb8..c988c0bc5 100644 --- a/ui/src/app/enrolment/finished/exam-participation.component.html +++ b/ui/src/app/enrolment/finished/exam-participation.component.html @@ -66,8 +66,8 @@

> {{ 'i18n_comments_open' | translate }} {{ 'i18n_comments_hide' | translate }} - - + + diff --git a/ui/src/app/exam/editor/sections/section-question.component.html b/ui/src/app/exam/editor/sections/section-question.component.html index 60dc44838..60f16f72e 100644 --- a/ui/src/app/exam/editor/sections/section-question.component.html +++ b/ui/src/app/exam/editor/sections/section-question.component.html @@ -77,16 +77,8 @@ > {{ 'i18n_show_more' | translate }} {{ 'i18n_hide' | translate }} - - + + } diff --git a/ui/src/app/examination/question/examination-question.component.html b/ui/src/app/examination/question/examination-question.component.html index 8a968a5d1..1fdb5372b 100644 --- a/ui/src/app/examination/question/examination-question.component.html +++ b/ui/src/app/examination/question/examination-question.component.html @@ -14,8 +14,27 @@ } + +
+ +
-
+
@if (sq.question.type !== 'ClozeTestQuestion') { @if (expanded) {
@@ -32,18 +51,6 @@
}
- -
-
- -
-
@if (sq.answerInstructions && expanded) { diff --git a/ui/src/app/examination/question/examination-question.component.ts b/ui/src/app/examination/question/examination-question.component.ts index 17d4c0938..2ea6a15ae 100644 --- a/ui/src/app/examination/question/examination-question.component.ts +++ b/ui/src/app/examination/question/examination-question.component.ts @@ -71,6 +71,11 @@ export class ExaminationQuestionComponent implements OnInit, AfterViewInit { const { answer } = this.sq.clozeTestAnswer; this.clozeAnswer = JSON.parse(answer); } + this.questionTitle = this.removeParagraphTags(this.sq.question.question); + } + + removeParagraphTags(input: string): string { + return input.replace(/<\/?p>/g, ''); } ngAfterViewInit() { From 601b55bb8da48a14d089fcd8694555e9644d7fd7 Mon Sep 17 00:00:00 2001 From: Aurora Virmasalo Date: Wed, 4 Sep 2024 09:15:17 +0300 Subject: [PATCH 2/4] Replace Regex with .replace --- .../question/examination-question.component.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ui/src/app/examination/question/examination-question.component.ts b/ui/src/app/examination/question/examination-question.component.ts index 2ea6a15ae..2745bf567 100644 --- a/ui/src/app/examination/question/examination-question.component.ts +++ b/ui/src/app/examination/question/examination-question.component.ts @@ -75,7 +75,19 @@ export class ExaminationQuestionComponent implements OnInit, AfterViewInit { } removeParagraphTags(input: string): string { - return input.replace(/<\/?p>/g, ''); + const openTag = '

'; + const closeTag = '

'; + let result = input; + + while (result.includes(openTag)) { + result = result.replace(openTag, ''); + } + + while (result.includes(closeTag)) { + result = result.replace(closeTag, ''); + } + + return result; } ngAfterViewInit() { From 02c4fe41ffad8e35c6a4b812e6893ee51f7793ce Mon Sep 17 00:00:00 2001 From: Aurora Virmasalo Date: Tue, 17 Sep 2024 10:08:17 +0300 Subject: [PATCH 3/4] Refactor arialabel parsing --- .../question/examination-question.component.html | 8 +------- .../question/examination-question.component.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ui/src/app/examination/question/examination-question.component.html b/ui/src/app/examination/question/examination-question.component.html index 1fdb5372b..af20059cd 100644 --- a/ui/src/app/examination/question/examination-question.component.html +++ b/ui/src/app/examination/question/examination-question.component.html @@ -19,13 +19,7 @@