An open API service indexing awesome lists of open source software.

https://github.com/melsumner/ember-a11y-dropdown

A super simple, accessible dropdown component for use in Ember apps.
https://github.com/melsumner/ember-a11y-dropdown

accessibility addon ember

Last synced: 11 months ago
JSON representation

A super simple, accessible dropdown component for use in Ember apps.

Awesome Lists containing this project

README

          

# ember-a11y-dropdown

**Note: this is not to replace a `` element in a form.**

This is a very simple, accessible dropdown that you can use in your Ember app for something like a menu dropdown-- or [disclosure navigation menu])https://www.w3.org/TR/wai-aria-practices-1.2/examples/disclosure/disclosure-navigation.html)

It's pretty narrow in scope, and there are other addons that do fancier things.

Use this addon if you:

* want to stop using a `details` element (which is an interactive element so cannot contain other interactive elements)
* need a dropdown menu to put in the header or nav of your site (like a user menu)
* are okay with styling the CSS in your app's stylesheets

Whatever else you may be able to force this component to do is coincidental.

## Compatibility

* Ember.js v3.24 or above
* Ember CLI v3.24 or above
* Node.js v12 or above

## Installation

I haven't released this addon yet, but once I do you can install it the same way you do other Ember addons:

```bash
ember install ember-a11y-dropdown
```

## Usage

The component markup:

* a `div` to wrap the entire component so it doesn't mess up your flex or grid layout
* a `button` element to show/hide the dropdown
* a `ul` element that contains the dropdown
* the `LinkTo` components (link element) if a route is defined
* a `li` with `role="separator"` (if needed)

### Styling

The specificity in the addon is kept at single level; it is explicitly only the class names that are attached to each element of the component. That means if you want to override on your own, you can. In fact, it is likely that you'll want to override the default styles.

* the wrapping `

` has the class `ea-dropdown`
* the `` has the class `ea-dropdown__button`
* the `