A "restore focus after a command runs" callback, published by a container (e.g. a toolbar) and
invoked by descendant useCommands consumers on execute.
This is the focus analogue of the enclosing-float close-on-execute (see useFloat): behavior
belongs to the consumer/container, discovered through context, never threaded per-button.
A toolbar captures the element that was focused before the toolbar took focus and, after a button
runs a command, returns focus there (so the grid keeps the caret). null ⇒ no restore.
The callback is expected to be a stable reference (e.g. useCallbackRef) and to no-op when focus
has already left the container — so a remote dispatch (a keystroke from the grid) never steals it.
A "restore focus after a command runs" callback, published by a container (e.g. a toolbar) and invoked by descendant useCommands consumers on execute.
This is the focus analogue of the enclosing-float close-on-execute (see
useFloat): behavior belongs to the consumer/container, discovered through context, never threaded per-button. A toolbar captures the element that was focused before the toolbar took focus and, after a button runs a command, returns focus there (so the grid keeps the caret).null⇒ no restore.The callback is expected to be a stable reference (e.g.
useCallbackRef) and to no-op when focus has already left the container — so a remote dispatch (a keystroke from the grid) never steals it.