Coder Social home page Coder Social logo

aberkow / a11y-menu Goto Github PK

View Code? Open in Web Editor NEW
25.0 5.0 2.0 2.69 MB

Home Page: https://aberkow.github.io/a11y-menu/

HTML 20.20% JavaScript 35.12% CSS 5.18% Shell 0.24% PHP 28.72% SCSS 10.55%
accessibility menus wordpress-menu composer javascript

a11y-menu's People

Contributors

aberkow avatar briankelleher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

a11y-menu's Issues

Uncaught TypeError on clicks when menu is open

when the menu is closed and a click event is registered, an error occurs with

Uncaught TypeError: (intermediate value)(intermediate value).getElementsByTagName is not a function

Navigation.js 40

Menu Walker - Parent Non-Link Detection

Right now, in the menu walker, in order to set a top level item you must have absolutely nothing in the link field for a menu item. "#" will trigger it being a link, where "" will not.

Can we add support for having "#" in the link field, since this is the default for a blank link/custom link in WordPress?

Click menus take two clicks to open a second submenu

This is a bug I've found with the click menus.

Here is my example menu setup:

  • Toggle1
    • Submenu1
  • Toggle2
    • Submenu2

Here is what happens:

  1. Page loads, click toggle1: toggle1 gets focus class, submenu1 gets open class
  2. Click toggle2: toggle1 loses focus class, submenu1 loses open class, toggle2 receives focus class, submenu2 does not receive open class
  3. Click toggle2 again: toggle2 receives focus class again, submenu2 receives open class

Here is a visual example: https://www.loom.com/share/2c524cd8b3a0477abf748cb30fa3ede0

fix FOUC on icons when loaded via JS

@briankelleher points out that "icons are assigned via a style tag that is included via JS
so none of it runs until the page has already rendered and THEN icons load".

needs some different kind of implementation for they're set.

Clicks on links are being blocked

because evt.preventDefault is called when clicks happen in the menu, buttons work correctly, but links don't. needs better logic to handle whether a click is on a link or a button.

sub-sub-menus should auto-collapse

currently when when tabbing through a menu, sub-menus auto close. however, sub-sub-menus don't. this means that the links and buttons inside can still gain non-visual focus.

Add support for Click instead of Hover

Default functionality right now revolves around top level items being hovered on - add support for this to be click based rather than hover, and probably give the option.

Namespace (Suggested) SCSS

The SCSS snippet from (icon-styles.scss) are good, however they apply to ALL nav items. Suggest namespacing a11y-menu somehow with a class or an ID. Might be related to instructions that require you to include an ID when initializing the menu in JS.

Focus does not move into both menus when two are present

When there are two instances of the menu are being used on the page, only the first menu to be opened properly moved the focus into the menu.

To replicate:

  1. Instantiate two menus on the page, each containing at least 1 sub-menu
  2. Open the sub-menu on menu1 using the keyboard controls and tab into the menu.
  3. Tab to menu2 and open a sub-menu with the keyboard controls. Whenever you try to tab into this menu, you will notice that the submenu closes and hitting tab moves focus to the next main menu item.

Regardless of which menu you open first, the other menu will always have this issue. Because it's easier to show than explain, I also recorded a screencast of the issue: https://www.loom.com/share/c9223214e1f64b12aba973884bcd084b

Provide Custom Events to Hook Into

A fantastic addition would be the ability to hook into certain events happening on the JavaScript side of things, such as when a submenu is toggled, focused, etc, per your lib. That way, we can manipulate the menu on these events without having to dig into the source code for this project or forking.

I found a decent answer below where the user simply triggers an event after the necessary functions were run. Could be a good starting point:

https://stackoverflow.com/questions/20761612/how-do-i-check-if-a-data-attribute-changes

ESC Functionality

You should be able to close a full drop down menu with the escape key.

add a class to list items that include an outbound link

a case came up where an icon was requested for outbound links. personally I don't much care for outbound links in main navigation menus. that being said, a class on list items containing outbound links might be helpful for some. that way an icon could be added to those links to visually indicate that they are different than internal nav items.

Close open submenus when clicking out

When there's an open submenu and you click away from it (not selecting an item) the submenu remains open. if you click on the top level item again, the visual icon switches, but the submenu remains open.

submenus should close and the icon should reset when there's a click outside the menu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.