File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
client/src/templates/Challenges/quiz Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 99.quiz-challenge-container div [role = 'radiogroup' ] label p : last-child {
1010 margin-bottom : 0 ;
1111}
12+
13+ /* Quiz question text and option text have the <p> tag removed
14+ so the HTML can be semantically correct.
15+ This also removes the `p` styles that the text should have,
16+ so we need to clone the CSS of the `p` element here. */
17+ .quiz-question-label ,
18+ .quiz-answer-label {
19+ line-height : 1.5rem ;
20+ font-weight : 400 ;
21+ font-size : 1rem ;
22+ margin : 0 0 1.2rem ;
23+ }
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ interface ShowQuizProps {
8585 closeFinishQuizModal : ( ) => void ;
8686}
8787
88+ const removeParagraphTags = ( text : string ) => text . replace ( / ^ < p > | < \/ p > $ / g, '' ) ;
89+
8890const ShowQuiz = ( {
8991 challengeMounted,
9092 data : {
@@ -143,7 +145,12 @@ const ShowQuiz = ({
143145 const distractors = question . distractors . map ( ( distractor , index ) => {
144146 return {
145147 label : (
146- < PrismFormatted className = 'quiz-answer-label' text = { distractor } />
148+ < PrismFormatted
149+ className = 'quiz-answer-label'
150+ text = { removeParagraphTags ( distractor ) }
151+ useSpan
152+ noAria
153+ />
147154 ) ,
148155 value : index + 1
149156 } ;
@@ -153,14 +160,23 @@ const ShowQuiz = ({
153160 label : (
154161 < PrismFormatted
155162 className = 'quiz-answer-label'
156- text = { question . answer }
163+ text = { removeParagraphTags ( question . answer ) }
164+ useSpan
165+ noAria
157166 />
158167 ) ,
159168 value : 4
160169 } ;
161170
162171 return {
163- question : < PrismFormatted text = { question . text } /> ,
172+ question : (
173+ < PrismFormatted
174+ className = 'quiz-question-label'
175+ text = { removeParagraphTags ( question . text ) }
176+ useSpan
177+ noAria
178+ />
179+ ) ,
164180 answers : shuffleArray ( [ ...distractors , answer ] ) ,
165181 correctAnswer : answer . value
166182 } ;
You can’t perform that action at this time.
0 commit comments