Skip to content

Commit

Permalink
Fix: Exclude hidden items from items count ARIA (fixes #164) (#170)
Browse files Browse the repository at this point in the history
* Fix: Exclude hidden items from items count ARIA

* Fix: BoxMenuGroupView updated to exclude hidden children.
  • Loading branch information
joe-allen-89 authored Oct 30, 2023
1 parent 0ac6fe6 commit 2a09783
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion js/BoxMenuGroupView.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class BoxMenuGroupView extends MenuItemView {
}

updateItemCount() {
const models = this.model.getChildren().models;
const models = this.model.getChildren().where({
_isHidden: false
});
const totalChildren = models.length;
models.forEach(model => model.set('_totalChild', totalChildren));
}
Expand Down
6 changes: 5 additions & 1 deletion js/BoxMenuView.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class BoxMenuView extends MenuView {
addChildren() {
let nthChild = 0;
const models = this.model.getChildren().models;
const totalChild = this.model.getChildren().where({
_isHidden: false
}).length;

const childViews = [];
models.forEach(model => {
if (!model.get('_isAvailable')) return;
Expand All @@ -35,7 +39,7 @@ class BoxMenuView extends MenuView {
nthChild++;
model.set({
_nthChild: nthChild,
_totalChild: models.length
_totalChild: totalChild
});

const ChildView = (model.get('_type') === 'menu' && model.get('_boxMenu') && model.get('_boxMenu')._renderAsGroup) ?
Expand Down

0 comments on commit 2a09783

Please sign in to comment.