Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

_itemButtons navigation dots & a11y #44

Closed
jamesrea83 opened this issue Feb 27, 2020 · 6 comments
Closed

_itemButtons navigation dots & a11y #44

jamesrea83 opened this issue Feb 27, 2020 · 6 comments

Comments

@jamesrea83
Copy link

jamesrea83 commented Feb 27, 2020

In a course I'm working on the blocks in the ABS do not have titles assigned. As a result the aria-labels for the navigation dots are blank, causing the screen reader to read out "unlabelled x button".

Giving the blocks a title solves the aria-label, but with the default styling part of the title is rendered in each of the navigation dots.

Would it make sense to change the template to aria-label="{{displayTitle}}" to give flexibility for cases like this?

@oliverfoster
Copy link
Member

https://github.com/cgkineo/adapt-articleBlockSlider/blob/master/js/adapt-articleView.js#L111

_title: blocks[i].get('title') || blocks[i].get('displayTitle')

@jamesrea83
Copy link
Author

jamesrea83 commented Feb 27, 2020

Unfortunately that doesn't help- _title is being used by both aria-label & item-button-inner

<button class="base item-button {{_className}}" aria-label="{{_title}}" data-block-slider="index" data-block-slider-index="{{this._index}}"><span class="item-button-inner">{{_title}}</span></button>

@moloko
Copy link
Contributor

moloko commented Feb 27, 2020

Might as well have a bit of a tidy up at the same time...!

_blockSliderConfigureVariables: function() {
  var blocks = this.model.getChildren().models;
  var itemButtons = [];
  
  blocks.forEach(function(block, i) {
    itemButtons.push({
      _className: (i === 0 ? 'home' : 'not-home') + (' i'+i),
      _index: i,
      _includeNumber: i !== 0,
      _title: block.get('title')
    });
  });
  
  this.model.set({
    _currentBlock: 0,
    _totalBlocks: blocks.length,
    _itemButtons: itemButtons
  });
}

how about this for the template?

<button class="base item-button {{_className}}" aria-label="{{#if _title}}{{_title}}{{else}}{{inc _index}}/{{../totalBlocks}}{{/if}}" data-block-slider="index" data-block-slider-index="{{this._index}}"></button>

@moloko
Copy link
Contributor

moloko commented Feb 27, 2020

oh, hang on - is this the one where the item-button is used both for the progress dots and for the tab buttons??

@moloko
Copy link
Contributor

moloko commented Feb 27, 2020

just to note the navigation dots are something that were created for a specific project/client and I don't think are normally supported by the out-of-the-box ABS - so not sure this ticket is necessarily relevant (here)

@moloko
Copy link
Contributor

moloko commented Feb 27, 2020

although note that this feature has been requested in #40 - but I think if we do that we should do it differently to what @jamesrea83 is looking at

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants