From c556847eb1266e5b1cfb951806b15bef7ecb5b78 Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Mon, 10 Jun 2024 09:31:47 -0600 Subject: [PATCH] Fix: Resolve title/altTitle discrepancy (fixes #535) --- js/models/questionModel.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/models/questionModel.js b/js/models/questionModel.js index 8e785944..75989c85 100644 --- a/js/models/questionModel.js +++ b/js/models/questionModel.js @@ -283,12 +283,13 @@ class QuestionModel extends ComponentModel { ) || {}; }; - const altTitle = feedback.altTitle || Adapt.course.get('_globals')._accessibility.altFeedbackTitle; - const title = feedback.title || this.get('title') || altTitle || ''; + const altFeedbackTitle = Adapt.course.get('_globals')._accessibility.altFeedbackTitle; + const hasTitle = Boolean(feedback.title || this.get('title')); + const isAltTitle = Boolean(feedback.altTitle) || (!hasTitle && altFeedbackTitle); + const title = (feedback.altTitle || feedback.title || this.get('title') || altFeedbackTitle || ''); const feedbackConfig = { - isAltTitle: (title === altTitle), - altTitle, + isAltTitle, title: Handlebars.compile(title)(this.toJSON()), _classes: feedback._classes, ...(isLegacyConfig @@ -307,7 +308,7 @@ class QuestionModel extends ComponentModel { // Used to setup the correct, incorrect and partly correct feedback setupFeedback() { if (!this.has('_feedback')) return; - const { altTitle = '', title = '', body = '' } = this.getFeedback(); + const { title = '', body = '' } = this.getFeedback(); this.set({ feedbackTitle: Handlebars.compile(title)(this.toJSON()),