Skip to content

Commit

Permalink
Fix disabled menu accessibility (#77)
Browse files Browse the repository at this point in the history
* Use getBoundingClientRect instead of clientHeight

* Doing some magic with focus

* WIP

* clean up

* minor cleanup

* revert changes to index.vue

* fixed unable to tab back up menu

* undo unnecessary change

* another unnecessary change

* fix es5 incompatibility

* added check for disabled menu items

Co-authored-by: Andrew Fisher <fisher@cognitoforms.com>
Co-authored-by: Lauren Nix <lauren@cognitoforms.com>
  • Loading branch information
3 people authored May 9, 2022
1 parent 7b43c24 commit eb11016
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/menu/aria-submenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ SubMenu.prototype.init = function() {

SubMenu.prototype.gotoSubIndex = function(idx) {
// Calculate if going up or down in menu
var isDown = this.subIndex < idx;
var isDown = this.subIndex <= idx;
// Grab focusable menu items that are not hidden
let focusable = this.domNode.querySelectorAll('[class^="el-menu--"]:not([style*="display: none"]) > .el-menu > li');
let focusable = this.domNode.querySelectorAll('[class^="el-menu--"]:not([style*="display: none"]) > .el-menu > li:not(.is-disabled)');
let focusableItems = [].slice.call(focusable);
// If current idx is not focusable, skip it
while (!focusableItems.includes(this.subMenuItems[idx]) && ((isDown && idx < this.subMenuItems.length) || (!isDown && idx >= 0))) {
Expand Down

0 comments on commit eb11016

Please sign in to comment.