@jsenv/navi 0.29.86 → 0.29.87
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/jsenv_navi.js +21 -23
- package/dist/jsenv_navi.js.map +3 -3
- package/docs/autofocus.md +20 -12
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -21855,11 +21855,11 @@ const markAutofocusRestoreOnClose = (
|
|
|
21855
21855
|
* @param {object} [options]
|
|
21856
21856
|
* @param {boolean} [options.skipFirstFocusable]
|
|
21857
21857
|
* Drops step 2 — the focus then goes where something ASKED for it, or to the
|
|
21858
|
-
* last resort, which for a container is itself.
|
|
21859
|
-
*
|
|
21860
|
-
*
|
|
21861
|
-
*
|
|
21862
|
-
*
|
|
21858
|
+
* last resort, which for a container is itself. What arrives is read before
|
|
21859
|
+
* it is reached: the first focusable is wherever the content happens to put
|
|
21860
|
+
* it, so landing there scrolls whatever comes before it out of sight.
|
|
21861
|
+
* transferFocus turns this on by itself wherever the keyboard is a virtual
|
|
21862
|
+
* one — see the reasoning there.
|
|
21863
21863
|
* @returns {{target: HTMLElement, reason: string}|undefined}
|
|
21864
21864
|
*/
|
|
21865
21865
|
const findFocusTarget = (containerEl, { skipFirstFocusable } = {}) => {
|
|
@@ -21978,11 +21978,22 @@ const prepareFocusTransfer = (prepareEvent, debugFocus) => {
|
|
|
21978
21978
|
* undefined when it focused straight away and there is nothing to take
|
|
21979
21979
|
* back.
|
|
21980
21980
|
*/
|
|
21981
|
-
transferFocus: (
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21981
|
+
transferFocus: (transferEvent, containerEl, { getDelay } = {}) => {
|
|
21982
|
+
// Where the keyboard is a virtual one, an arrival lands on what ASKED for
|
|
21983
|
+
// the focus, or on the surface — never on the first focusable that
|
|
21984
|
+
// happens to be there. That element costs the top of what just arrived
|
|
21985
|
+
// twice over: the browser scrolls it into view, and a field raises a
|
|
21986
|
+
// keyboard taking a third of what is left, so the title and the sentence
|
|
21987
|
+
// saying what this is about are gone before it has been looked at. A
|
|
21988
|
+
// field that really is what one came for asks by name (step 2) and gets
|
|
21989
|
+
// the keyboard anyway.
|
|
21990
|
+
//
|
|
21991
|
+
// The device, not the interaction (unlike the delay callers apply on top
|
|
21992
|
+
// of this): whether focusing raises a keyboard over what arrived is true
|
|
21993
|
+
// of the screen, and an arrival with no pointer in it at all — a popup
|
|
21994
|
+
// opened by the page loading, a travel asked for by code — is precisely
|
|
21995
|
+
// the one that must not be answered "no keyboard here".
|
|
21996
|
+
const skipFirstFocusable = coarsePointerSignal.value;
|
|
21986
21997
|
let target;
|
|
21987
21998
|
let reason;
|
|
21988
21999
|
containerEl.removeAttribute(AUTOFOCUS_UNPLACED_ATTRIBUTE);
|
|
@@ -29413,19 +29424,6 @@ const createOpenController = (
|
|
|
29413
29424
|
findEvent(requestOpenEvent, isTouchDrivenEvent),
|
|
29414
29425
|
);
|
|
29415
29426
|
const cancelPendingFocus = focusTransfer.transferFocus(e, el, {
|
|
29416
|
-
// A popup is READ before it is reached wherever the keyboard is a
|
|
29417
|
-
// virtual one. Landing on the first focusable there costs the top of
|
|
29418
|
-
// the popup twice over: the browser scrolls that element into view,
|
|
29419
|
-
// and a field raises a keyboard that takes a third of what is left —
|
|
29420
|
-
// so the title and the sentence saying what this is about are gone
|
|
29421
|
-
// before the popup has been looked at. Only something that ASKED for
|
|
29422
|
-
// the focus is worth that, and asking is what `autoFocus` is.
|
|
29423
|
-
//
|
|
29424
|
-
// The device, not the opening (unlike the delay below): whether
|
|
29425
|
-
// focusing raises a keyboard over the popup is true of the screen,
|
|
29426
|
-
// and a popup opened by the page loading — no pointer in it at all —
|
|
29427
|
-
// is precisely the one that must not be answered "no keyboard here".
|
|
29428
|
-
skipFirstFocusable: coarsePointerSignal.value,
|
|
29429
29427
|
getDelay: (target) =>
|
|
29430
29428
|
openedByTouch && isEditableTarget(target)
|
|
29431
29429
|
? FOCUS_DELAY_ON_KEYBOARD_MS
|