Skip to content

Commit

Permalink
Fix: Resolve title/altTitle discrepancy (fixes #535)
Browse files Browse the repository at this point in the history
  • Loading branch information
swashbuck authored Jun 10, 2024
1 parent 9c3ce16 commit c556847
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions js/models/questionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()),
Expand Down

0 comments on commit c556847

Please sign in to comment.