adaptlearning / adapt-contrib-narrative

A component that displays an image gallery with accompanying text
GNU General Public License v3.0
5 stars 39 forks source link

_isMobileTextBelowImage set to true can prevent completion #220

Closed chris-steele closed 2 years ago

chris-steele commented 2 years ago

If _setCompletionOn is set to allItems and _isMobileTextBelowImage is true then the component will not complete once all items have been visited on mobile devices.

N.B. this is because _isVisited is only set to true when the display text is opened in an overlay.

chris-steele commented 2 years ago

Propose change:

onItemsActiveChange(item, _isActive) {
    if (!_isActive) return;
    this.setStage(item);
    this.setFocus(item.get('_index'));
  }

to

onItemsActiveChange(item, _isActive) {
    if (!_isActive) return;
    if (this.isTextBelowImage()) {
      item.toggleVisited(true);
    }
    this.setStage(item);
    this.setFocus(item.get('_index'));
  }