Skip to content

Remove _isHighlighted property #239

@swashbuck

Description

@swashbuck

Subject of the issue

Currently, the onItemFocus and onItemBlur methods exist only to control whether an item is highlighted.

onItemFocus(event) {
if (!this.model.isInteractive()) return;
const index = parseInt($(event.currentTarget).data('adapt-index'));
const item = this.model.getChildren().findWhere({ _index: index });
item.set('_isHighlighted', true);
}
onItemBlur(event) {
const index = $(event.currentTarget).data('adapt-index');
const item = this.model.getChildren().findWhere({ _index: index });
item.set('_isHighlighted', false);
}

The _isHighlighted property then determines if an is-highlighted class should be added to the item.

className={classes([
'mcq-item__label',
'u-no-select',
!_isEnabled && 'is-disabled',
_isHighlighted && 'is-highlighted',
(_isCorrectAnswerShown ? _shouldBeSelected : _isActive) && 'is-selected'
])}

There are no styles associated with a is-highlighted either in the plugin or in core. It's unclear whether this CSS class was ever used. For targeting focus states, there are CSS selectors that can be used that are supported by modern browsers.

Unless anyone objects, I think we should remove references to _isHighlighted altogether. This applies to GMCQ and possibly Matching as well.

Your environment

  • MCQ 7.6.0

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions