@absolutejs/beacon 0.7.0-beta.26 → 0.7.0-beta.27
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/CHANGELOG.md +6 -0
- package/README.md +20 -0
- package/changelog.json +14 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +48 -16
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ This file is generated by `absolute-changelog` from the entries in
|
|
|
6
6
|
`changelog/`. Edit an entry, not this file — and add new ones under
|
|
7
7
|
`changelog/unreleased/`.
|
|
8
8
|
|
|
9
|
+
## 0.7.0-beta.27 — 2026-11-30
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Describe removed-control focus loss without claiming dialog closure; retain bounded dialog visibility, focus destination and recovery timing evidence, honor focusLoss opt-out, and cancel pending checks on close. Existing issue grouping and detected warnings are preserved.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
14
|
+
|
|
9
15
|
## 0.7.0-beta.26 — 2026-11-22
|
|
10
16
|
|
|
11
17
|
### Fixed
|
package/README.md
CHANGED
|
@@ -410,3 +410,23 @@ before Beacon initialized or prove that a high paint value meant a blank page.
|
|
|
410
410
|
No page content, user identifiers, extra request, or polling timer is added.
|
|
411
411
|
Hosts using strict attribution schemas must allow the optional `pageLifecycle`
|
|
412
412
|
object to retain this context. `close()` removes its listeners.
|
|
413
|
+
|
|
414
|
+
### Focus-loss diagnostics
|
|
415
|
+
|
|
416
|
+
The `focus_lost` watchdog observes a disconnected dialog control and keyboard focus
|
|
417
|
+
on the document body after a zero-delay check. It does not prove that the dialog
|
|
418
|
+
closed. `extra.focusLoss` records content-free snapshots at focusout, detection,
|
|
419
|
+
and after a bounded 100 ms observation: dialog connectivity/rendered state, control
|
|
420
|
+
connectivity, active element tag, dialog focus ownership, and elapsed time.
|
|
421
|
+
`focusRecovered` records whether focus returned by the final snapshot; recovery
|
|
422
|
+
does not discard an already detected warning. Synchronous or microtask restoration
|
|
423
|
+
before detection does not produce a warning. Later restoration is not observed.
|
|
424
|
+
`focusEventTrusted` describes browser dispatch, not human intent: calling
|
|
425
|
+
`focus()` or `blur()` programmatically can produce trusted events.
|
|
426
|
+
|
|
427
|
+
The signal retains its dialog-based grouping across the wording change.
|
|
428
|
+
`signals.focusLoss: false` disables it independently of modal escape detection,
|
|
429
|
+
and closing the SDK cancels pending observations. Rendered state checks DOM
|
|
430
|
+
connectivity, native dialog open state, hidden/inert attributes, and computed
|
|
431
|
+
visibility on the element and its ancestors; it does not establish viewport
|
|
432
|
+
intersection or lack of occlusion.
|
package/changelog.json
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "@absolutejs/beacon",
|
|
4
4
|
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "fixed",
|
|
9
|
+
"summary": "Describe removed-control focus loss without claiming dialog closure; retain bounded dialog visibility, focus destination and recovery timing evidence, honor focusLoss opt-out, and cancel pending checks on close. Existing issue grouping and detected warnings are preserved.",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"createBeacon",
|
|
12
|
+
"BEACON_SDK_VERSION"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"date": "2026-11-30",
|
|
17
|
+
"version": "0.7.0-beta.27"
|
|
18
|
+
},
|
|
5
19
|
{
|
|
6
20
|
"changes": [
|
|
7
21
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type BeaconLevel = "fatal" | "error" | "warning" | "info";
|
|
|
5
5
|
/** Response header used to correlate a browser signal with its server request. */
|
|
6
6
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
7
7
|
/** Beacon package version retained with every captured event. */
|
|
8
|
-
export declare const BEACON_SDK_VERSION = "0.7.0-beta.
|
|
8
|
+
export declare const BEACON_SDK_VERSION = "0.7.0-beta.27";
|
|
9
9
|
/** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
|
|
10
10
|
export type BeaconTags = Record<string, string> & {
|
|
11
11
|
signal?: BeaconSignal;
|
package/dist/index.js
CHANGED
|
@@ -311,7 +311,7 @@ var consumeEarlyLayoutShiftBuffer = () => {
|
|
|
311
311
|
|
|
312
312
|
// src/index.ts
|
|
313
313
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
314
|
-
var BEACON_SDK_VERSION = "0.7.0-beta.
|
|
314
|
+
var BEACON_SDK_VERSION = "0.7.0-beta.27";
|
|
315
315
|
var inBrowser = () => typeof window !== "undefined";
|
|
316
316
|
var newId = () => {
|
|
317
317
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -4055,8 +4055,10 @@ var createBeacon = (options) => {
|
|
|
4055
4055
|
const modalTimers = new Set;
|
|
4056
4056
|
const modalVisibility = new WeakMap;
|
|
4057
4057
|
const knownModals = new Set;
|
|
4058
|
-
const
|
|
4059
|
-
if (!modal.isConnected
|
|
4058
|
+
const isRenderedDialog = (modal) => {
|
|
4059
|
+
if (!modal.isConnected)
|
|
4060
|
+
return false;
|
|
4061
|
+
if (modal.localName === "dialog" && !modal.hasAttribute("open"))
|
|
4060
4062
|
return false;
|
|
4061
4063
|
let current = modal;
|
|
4062
4064
|
while (current !== null) {
|
|
@@ -4071,6 +4073,7 @@ var createBeacon = (options) => {
|
|
|
4071
4073
|
}
|
|
4072
4074
|
return true;
|
|
4073
4075
|
};
|
|
4076
|
+
const isRenderedModal = (modal) => modal.matches(MODAL_SELECTOR) && isRenderedDialog(modal);
|
|
4074
4077
|
const reportModalEscape = (modal, active, reason) => {
|
|
4075
4078
|
if (signals.modalFocusEscape === false || reportedModalEscapes.has(modal) || document.visibilityState === "hidden") {
|
|
4076
4079
|
return;
|
|
@@ -4132,31 +4135,60 @@ var createBeacon = (options) => {
|
|
|
4132
4135
|
}
|
|
4133
4136
|
};
|
|
4134
4137
|
const onFocusOut = (event) => {
|
|
4138
|
+
if (signals.focusLoss === false)
|
|
4139
|
+
return;
|
|
4135
4140
|
const target = event.target;
|
|
4136
4141
|
if (!(target instanceof Element))
|
|
4137
4142
|
return;
|
|
4138
4143
|
const dialog = target.closest(DIALOG_SELECTOR);
|
|
4139
4144
|
if (dialog === null)
|
|
4140
4145
|
return;
|
|
4146
|
+
const startedAt = performance.now();
|
|
4141
4147
|
const dialogDescriptor = describeElement(dialog);
|
|
4148
|
+
const descriptor = describeElement(target);
|
|
4142
4149
|
const focusEventTrusted = event.isTrusted === true;
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4150
|
+
const snapshot = () => ({
|
|
4151
|
+
elapsedMs: Math.max(0, Math.round(performance.now() - startedAt)),
|
|
4152
|
+
targetConnected: target.isConnected,
|
|
4153
|
+
dialogConnected: dialog.isConnected,
|
|
4154
|
+
dialogRendered: isRenderedDialog(dialog),
|
|
4155
|
+
activeTag: document.activeElement?.localName ?? null,
|
|
4156
|
+
bodyFocused: document.activeElement === null || document.activeElement === document.body,
|
|
4157
|
+
dialogOwnsFocus: dialog.contains(document.activeElement)
|
|
4158
|
+
});
|
|
4159
|
+
const atFocusOut = snapshot();
|
|
4160
|
+
const relatedTargetTag = event.relatedTarget instanceof Element ? event.relatedTarget.localName : null;
|
|
4161
|
+
const timer = setTimeout(() => {
|
|
4162
|
+
modalTimers.delete(timer);
|
|
4163
|
+
const atDetection = snapshot();
|
|
4164
|
+
if (!atDetection.bodyFocused || atDetection.targetConnected)
|
|
4147
4165
|
return;
|
|
4148
|
-
const descriptor = describeElement(target);
|
|
4149
4166
|
if (reportedFocusLoss.has(descriptor))
|
|
4150
4167
|
return;
|
|
4151
4168
|
reportedFocusLoss.add(descriptor);
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4169
|
+
const observation = setTimeout(() => {
|
|
4170
|
+
modalTimers.delete(observation);
|
|
4171
|
+
const afterObservation = snapshot();
|
|
4172
|
+
emitSignal(`Focus lost — a focused dialog control was removed and keyboard focus fell to body — ${shortUrl(location.href)}`, {
|
|
4173
|
+
dialog: dialogDescriptor,
|
|
4174
|
+
focusEventTrusted: String(focusEventTrusted),
|
|
4175
|
+
lastFocused: descriptor,
|
|
4176
|
+
signal: BEACON_SIGNAL.FOCUS_LOST,
|
|
4177
|
+
...navigator.webdriver === true ? { automation: "webdriver" } : {}
|
|
4178
|
+
}, undefined, {
|
|
4179
|
+
focusLoss: {
|
|
4180
|
+
atFocusOut,
|
|
4181
|
+
atDetection,
|
|
4182
|
+
afterObservation,
|
|
4183
|
+
relatedTargetTag,
|
|
4184
|
+
focusRecovered: !afterObservation.bodyFocused,
|
|
4185
|
+
observationMs: MODAL_FOCUS_SETTLE_MS
|
|
4186
|
+
}
|
|
4187
|
+
});
|
|
4188
|
+
}, MODAL_FOCUS_SETTLE_MS);
|
|
4189
|
+
modalTimers.add(observation);
|
|
4159
4190
|
}, 0);
|
|
4191
|
+
modalTimers.add(timer);
|
|
4160
4192
|
};
|
|
4161
4193
|
document.addEventListener("focusin", onFocusIn, true);
|
|
4162
4194
|
document.addEventListener("focusout", onFocusOut, true);
|
|
@@ -5198,5 +5230,5 @@ export {
|
|
|
5198
5230
|
redactBeaconEvent
|
|
5199
5231
|
};
|
|
5200
5232
|
|
|
5201
|
-
//# debugId=
|
|
5233
|
+
//# debugId=920DAD3D3853F68964756E2164756E21
|
|
5202
5234
|
//# sourceMappingURL=index.js.map
|