@jsenv/navi 0.29.321 → 0.29.322
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/jsenv_navi.js +10 -1
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +10 -1
- package/dist/jsenv_navi.js.map +2 -2
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -34983,6 +34983,8 @@ const createDisplayedEvent = (ancestor, becauseAncestorOpened) => {
|
|
|
34983
34983
|
* @returns {Function} triggerAutofocus — can be called manually with a synthetic
|
|
34984
34984
|
* event to re-run the focus logic outside of the layout-effect lifecycle.
|
|
34985
34985
|
*/
|
|
34986
|
+
const NO_ELEMENT_REF = { current: null };
|
|
34987
|
+
|
|
34986
34988
|
const useAutoFocus = (
|
|
34987
34989
|
focusableElementRef,
|
|
34988
34990
|
autoFocus,
|
|
@@ -35114,8 +35116,15 @@ const useAutoFocus = (
|
|
|
35114
35116
|
};
|
|
35115
35117
|
};
|
|
35116
35118
|
|
|
35119
|
+
// Nothing to place when the control asks for no focus ("restore" is given
|
|
35120
|
+
// focus by a transfer, never by this effect): the displayed-effect is then
|
|
35121
|
+
// handed no element at all, so it never asks the layout whether one is on
|
|
35122
|
+
// screen — a question every control in a list would otherwise ask at
|
|
35123
|
+
// mount, for an answer this hook would not use. Read at mount, like the
|
|
35124
|
+
// deps below say.
|
|
35125
|
+
const claimsFocus = Boolean(autoFocus) && autoFocus !== "restore";
|
|
35117
35126
|
useDisplayedLayoutEffect(
|
|
35118
|
-
focusableElementRef,
|
|
35127
|
+
claimsFocus ? focusableElementRef : NO_ELEMENT_REF,
|
|
35119
35128
|
(el, e) => {
|
|
35120
35129
|
return triggerAutofocus(e);
|
|
35121
35130
|
},
|