Skip to main content

Function: useAmnesiaFocusClaim()

useAmnesiaFocusClaim(scopeId): AmnesiaFocusClaimHandlers

Defined in: use-scopes.ts:68

Returns capture-phase focus handlers that claim scopeId as the active scope while this surface is in use. Must be called inside an AmnesiaProvider.

Parameters

ParameterType
scopeIdstring

Returns

AmnesiaFocusClaimHandlers

Example

function PropertyPanel() {
const claim = useAmnesiaFocusClaim("props");
return (
<section tabIndex={-1} {...claim}>
<input />
</section>
);
}

The hook also releases the claim on unmount: if scopeId is the active claimant when the component tears down, the active scope falls back to the default. The release is a no-op when another scope was claimed in the meantime.

Single-flight: at most one claim is held at a time. The most recently claimed scope wins.