Giter VIP home page Giter VIP logo

chrisnajman / accessible-mobile-menu Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 51 KB

A responsive mobile menu with accessibility features designed for both screen reader users and keyboard-based navigation.

Home Page: https://chrisnajman.github.io/accessible-mobile-menu/

License: MIT License

CSS 25.54% HTML 59.72% JavaScript 14.74%
accessibility aria-attributes css-imports css-nesting dark-mode-toggle html-css-javascript js-modules mobile-menu svg-icons svg-animations

accessible-mobile-menu's Introduction

Accessible Mobile Menu

A responsive mobile menu that prioritizes accessibility features for screen readers and keyboard users.


Description

The mobile menu is designed to be responsive, and is visible on screens less than 768px wide. It is initially hidden and appears upon clicking the hamburger menu button. Clicking on a menu item will close the menu.


Accessibility Features

Screen Reader Accessibility

The menu is accessible to screen readers through the use of appropriate ARIA attributes.

ARIA Attributes Used

  • aria-controls="site-navigation": Associates the hamburger button with the site navigation menu.
  • aria-expanded="false" / aria-expanded="true": Dynamically updates the state of the navigation menu, indicating whether it's expanded or collapsed.

Keyboard Accessibility

The menu ensures accessibility for keyboard users by allowing them to navigate to the hamburger button using the keyboard's tab functionality. Once focused on the button, users can press the 'enter' key to toggle the visibility of the menu. This behavior ensures that keyboard users can interact with the menu effectively, enabling them to open and close it without relying on mouse interactions.

WAVE Web Accessibility Evaluation Tools Report


Usage

HTML Structure

The HTML structure comprises a div element with an ID of primary-navigation, containing the hamburger button and the navigation menu.

CSS

The CSS defines the styles for the mobile menu and the hamburger button, including responsive design for different screen sizes.

JavaScript Functionality

The JavaScript function btnHamburger() handles the click event on the hamburger button, toggling the visibility of the navigation menu and updating ARIA attributes accordingly.


Source


Testing

Tested on Windows 10 with:

  • Chrome
  • Firefox
  • Microsoft Edge

The page has been tested in both browser and device views.

accessible-mobile-menu's People

Contributors

chrisnajman avatar

Watchers

 avatar

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.