Socket
Socket
Sign inDemoInstall

@accessible/link

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @accessible/link

A component that adds aria attributes and keyboard functionality to non-A elements in order to make them act like native links


Version published
Maintainers
1
Created

Readme

Source

Bundlephobia Types Code coverage Build status NPM Version MIT License

npm i @accessible/link

A component that adds aria attributes and keydown events to non-A elements in order to make them act like native links.

Quick Start

import AccessibleLink from '@accessible/link'

const Component = () => (
  <AccessibleLink>
    <span onClick={() => (window.location.href = '/foo')}>Go to /foo</span>
  </AccessibleLink>
)

API

Adds role="link" and tabIndex={0} props to its child component unless those props are already defined in the child component's props. Also adds a keydown event for the Enter key which causes the component's onClick property to fire.

Props
PropTypeDefaultRequired?Description
childrenReact.ReactElementundefinedYesThe component you want to add accessible roles and keydown events to.

LICENSE

MIT

Keywords

FAQs

Last updated on 29 Dec 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc