R
fn

useEscapeKey

v0.0.14testeddemo

Register a callback for the topmost Escape keydown. Uses an internal stack so that nested layers (e.g. nested Dialogs) dismiss in the correct order — only the most recently-registered listener fires for a given keydown.

Demo

Loading demo…

Signature

ts
export function useEscapeKey(handler: EscapeListener): VoidFunction{ ... }

Parameters

ParameterTypeDescription
handlerEscapeListenerCallback invoked on the topmost Escape

Returns

VoidFunctionStop handle that removes the subscription