You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FocusLock has few props to tune behavior, all props are optional:
62
62
-`disabled`, to disable(enable) behavior without altering the tree.
63
63
-`className`, to set the `className` of the internal wrapper.
64
-
-`returnFocus`, to return focus into initial position on unmount(not disable).
65
-
> By default `returnFocus` is disabled, so FocusLock will __not__ restore original focus on deactivation.
64
+
-`returnFocus`, to return focus into initial position on unmount
65
+
> By default `returnFocus` is disabled, so FocusLock __will not__ restore original focus on deactivation.
66
+
> This was done mostly to avoid breaking changes. We __strong recommend enabling it__, to provide a better user experience.
66
67
67
68
This is expected behavior for Modals, but it is better to implement it by your self. See [unmounting and focus management](https://github.com/theKashey/react-focus-lock#unmounting-and-focus-management) for details
68
69
-`persistentFocus=false`, requires any element to be focused. This also disables text selections inside, and __outside__ focus lock.
@@ -329,6 +330,32 @@ to allow user _tab_ into address bar.
329
330
>
330
331
```
331
332
333
+
## Return focus to another node
334
+
In some cases the original node that was focused before the lock was activated is not the desired node to return focus to.
335
+
Some times this node might not exists at all.
336
+
337
+
- first of all, FocusLock need a moment to record this node, please do not hide it onClick, but hide onBlur (Dropdown, looking at you)
338
+
- second, you may specify a callback as `returnFocus`, letting you decide where to return focus to.
0 commit comments