furo-keydown

furo-keydown #

@furo/util v2.1.19
import '@furo/util/src/furo-keydown.js';
exports FuroKeydown js
exports <furo-keydown> custom-element-definition
superclass LitElement
mixes FBP

summary keyboard event listener

furo-keydown attaches a keypress listener to the parent element and gives you handy events to work with.

When you set alt, ctrl or any of the other arguments, the key event will be triggered only if the corresponding key was pressed too.

more about keydown

1
2
<furo-keydown key="Enter" at-key="--enterPressed"></furo-keydown>
<furo-keydown ctrl key="c" at-key="--copyRequested"></furo-keydown>

Attributes and Properties #

key #

key String

Key to listen on. Like Enter, Backspace, ArrowLeft, A,B,C, a,b,c

global #

global Boolean

Set this attribute to listen to the keydown event global (window).

alt #

alt Boolean

alt key must be pressed to trigger the key event.

ctrl #

ctrl Boolean

ctrl key must be pressed to trigger the key event.

meta #

meta Boolean

meta key must be pressed to trigger the key event.

shift #

shift Boolean

shift key must be pressed to trigger the key event.

preventDefault #

prevent-default Boolean

Set this attribute to prevent the event default of the keypress event.

stopPropagation #

stop-propagation Boolean

Set this to true to stop the event propagation of the keypress event.

Events #

key #

at-keyKeyboardEvent

Fired when key was catched on target

Methods #