Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score100%
Downloads1/wk
Published5 months ago (2.0.2)

Clicks on `kbd` DOM elements when their key is pressed. Useful for semantic keyboard shortcuts. Respects kbd visibility.

kbd-click

kbd-click component on Storybook kbd-click version on JSR JSR score

Trigger click events on child kbd elements

Using this package

Browser

<script src="https://esm.sh/jsr/@web-components/kbd-click" type="module"></script>

Deno

deno add jsr:@web-components/kbd-click

NPM

npx jsr add @web-components/kbd-click

Documentation

The kbd-click component listens on the document for key presses then fires clicks on any visible inner element that has a matching accesskey attribute or kbd where the innerText matches. This is useful for implementing keyboard shortcuts.

Attributes

  • allow-repeat - Whether or not repeat key presses should continue to trigger clicks. Default: false.
  • filter - A comma-separated list of keys that will be listened for. Other key presses will be ignored. Default: no filter.
  • capture - A boolean value indicating that key press events of this type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. If not specified, defaults to false.
  • passive - A boolean value that, if true, indicates that the function triggered by inner kbd clicks will never callpreventDefault(). Defaults to false`.

Made by jackcarey.

Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@web-components/kbd-click

Import symbol

import * as kbd_click from "@web-components/kbd-click";
or

Import directly with a jsr specifier

import * as kbd_click from "jsr:@web-components/kbd-click";

Add Package

pnpm i jsr:@web-components/kbd-click
or (using pnpm 10.8 or older)
pnpm dlx jsr add @web-components/kbd-click

Import symbol

import * as kbd_click from "@web-components/kbd-click";

Add Package

yarn add jsr:@web-components/kbd-click
or (using Yarn 4.8 or older)
yarn dlx jsr add @web-components/kbd-click

Import symbol

import * as kbd_click from "@web-components/kbd-click";

Add Package

vlt install jsr:@web-components/kbd-click

Import symbol

import * as kbd_click from "@web-components/kbd-click";

Add Package

npx jsr add @web-components/kbd-click

Import symbol

import * as kbd_click from "@web-components/kbd-click";

Add Package

bunx jsr add @web-components/kbd-click

Import symbol

import * as kbd_click from "@web-components/kbd-click";