activeElement$():
null
|Element
A readable store that tracks the currently active (focused) element in the document.
This store is only active in a browser environment. When not in a browser environment,
it will be a readable store with a null
value.
null
| Element
import { activeElement$ } from './focustrack';
activeElement$.subscribe((element) => {
console.log('Active element:', element);
});
The store updates whenever the active element changes, such as when the user focuses on a different input field or clicks on a different part of the document.
createHasFocus():
HasFocus
Create a HasFocus
a HasFocus
Interface representing an element that can have focus tracking.
directive:
Directive
Directive to put on some elements.
hasFocus$:
ReadableSignal
<boolean
>
Store that contains true if the activeElement is one of the elements which has the directive, or any of their descendants.