Release 1.0.8 with platform, security, and UI hardening.
Adds API filter registry, style theme registry, SW bitmask cache clear, KV namespacing, session expiry checks, accessibility improvements, and expanded test coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { useEffect } from 'react';
|
||||
import { addDocumentEventListener } from '../../platform/compat.js';
|
||||
|
||||
/**
|
||||
* @param {boolean} active
|
||||
* @param {(() => void) | null | undefined} onDismiss
|
||||
*/
|
||||
export function useEscapeDismiss(active, onDismiss) {
|
||||
useEffect(() => {
|
||||
if (!active || typeof onDismiss !== 'function') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
if (event.key === 'Escape') {
|
||||
onDismiss();
|
||||
}
|
||||
};
|
||||
|
||||
return addDocumentEventListener('keydown', handleKeyDown);
|
||||
}, [active, onDismiss]);
|
||||
}
|
||||
Reference in New Issue
Block a user