There have been a few breaking changes between version 2 and version 3 of accessible menu, to upgrade you should keep the following in mind.
Version 3 of accessible-menu has changed the naming scheme for compiled files to make them more "url-friendly".
dist/accessibleMenu.js
has changed todist/accessible-menu.js
, anddist/accessibleMenu.min.js
has changed todist/accessible-menu.min.js
.
Make sure you update your imports/script urls accordingly.
Version 3 of accessible-menu has completely overhauled the class system used to create the different menu classes.
The most important change with this is the creation of "base" menu item and toggle classes with each subclass of menu having it's own subclasses for menu times and toggles. This allows for easier one-off customization per-menu subclass without affecting all other menus.
menuItem.js
has been replaced with_baseMenuItem.js
and exports theBaseMenuItem
class.menuToggle.js
has been replaced with_baseMenuToggle.js
and exports theBaseMenuToggle
class.BaseMenu
now uses theBaseMenuItem
andBaseMenuToggle
classes.DisclosureMenu
now uses theDisclosureMenuItem
andDisclosureMenuToggle
classes.Menubar
now uses theMenubarItem
andMenubarToggle
classes.
If you have written custom subclass that extend the MenuItem
or MenuToggle
classes, they should now extend the BaseMenuItem
and BaseMenuToggle
classes respectively.
In version 2, Disclosure Menus always had the keyboard support that is labelled as "optional". This is no longer the case in version 3.
You will need to set the optionalKeySupport
value to true
to gain access to the optional keyboard support.
Version 3 of accessible-menu has cleaned up and renamed some class fields and methods:
BaseMenu.domElements
has been renamed toBaseMenu._dom
BaseMenu.domSelectors
has been renamed toBaseMenu._selectors
BaseMenu.menuElements
has been renamed toBaseMenu._elements
BaseMenu.submenuOpenClass
has been renamed toBaseMenu._openClass
BaseMenu.submenuCloseClass
has been renamed toBaseMenu._closeClass
BaseMenu.root
has been renamed toBaseMenu._root
BaseMenu.focussedChild
has been renamed toBaseMenu._currentChild
BaseMenu.state
has been renamed toBaseMenu._focusState
BaseMenu.event
has been renamed toBaseMenu._currentEvent
BaseMenu.hoverable
has been renamed toBaseMenu._hoverType
BaseMenu.delay
has been renamed toBaseMenu._hoverDelay
BaseMenu.setDOMElementType()
andBaseMenu.addDOMElementType()
have been merged intoBaseMenu._setDOMEelementType()
BaseMenu.clearDOMElementType()
has been renamed toBaseMenu._resetDOMElementType()
BaseMenu.setDOMElements()
has been renamed toBaseMenu._setDOMElements()
BaseMenu.findRootMenu()
has been renamed toBaseMenu._findRootMenu()
BaseMenu.createChildElements()
has been renamed toBaseMenu._createChildElements()
BaseMenu.handleFocus()
has been renamed toBaseMenu._handleFocus()
BaseMenu.handleClick()
has been renamed toBaseMenu._handleClick()
BaseMenu.handleHover()
has been renamed toBaseMenu._handleHover()
BaseMenu.handleKeydown()
has been renamed toBaseMenu._handleKeydown()
BaseMenu.handleKeyup()
has been renamed toBaseMenu._handleKeyup()
MenuItem.domElements
has been renamed toBaseMenuItem._dom
MenuItem.menuElements
has been renamed toBaseMenuItem._elements
MenuItem.isController
has been renamed toBaseMenuItem._submenu
MenuToggle.domElements
has been renamed toBaseMenuToggle._dom
MenuToggle.menuElements
has been renamed toBaseMenuToggle._elements
MenuToggle.show
has been renamed toBaseMenuToggle._open
MenuToggle.expandEvent
has been renamed toBaseMenuToggle._expandEvent
MenuToggle.collapseEvent
has been renamed toBaseMenuToggle._collapseEvent
MenuToggle.openClass
has been removedMenuToggle.closeClass
has been removed
MenuToggle.expand()
has been renamed toBaseMenuToggle._expand()
MenuToggle.collapse()
has been renamed toBaseMenuToggle._collapse()