Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a11y-disabled-modifier

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a11y-disabled-modifier

Accessible and usable button-disabling with a modifier

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

a11y-disabled-modifier

Implement accessible and usable button-disabling (inspired by this fantastic post on CSS Tricks) with a modifier:

<form {{on "submit" this.submit}}>
  <label>some text: <input type='text' /></label>
  <button type='submit' {{disabled when=this.isInvalid}}></button>
</form>

When the modifier is enabled with the required when named argument:

  • the target element has aria-disabled="true"
  • clicks on the button do not propagate
  • form submission does not trigger

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v12 or above

TypeScript

This project follows the current draft of the Semantic Versioning for TypeScript Types pro posal.

  • Currently supported TypeScript versions: v4.1 and v4.2
  • Compiler support policy: simple majors
  • Public API: all published types not in a -private module are public

-majors

Note: for the moment, the types provided here are basically inert. Glint users can see the implementation for types to use there.

Installation

ember install a11y-disabled-modifier

Usage

Use this modifier in place of the disabled attribute, which causes a variety of usability problems, when you absolutely must disable a button programmatically. Most of the time, you shouldn't use this at all: prefer to provide feedback on form submission instead!

For custom styling for disabled elements, you can use the [aria-disabled="true"] and [aria-disabled="false"] selectors. This guarantees that your styles will stay in sync with the runtime behavior of the app:

.my-button {
  /* default styles... */
}

.my-button[aria-disabled="true"] {
  cursor: not-allowed;
}

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 14 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc