@absolutejs/beacon 0.7.0-beta.25 → 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 +12 -0
- package/README.md +20 -0
- package/changelog.json +28 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +56 -19
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ 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
|
+
|
|
15
|
+
## 0.7.0-beta.26 — 2026-11-22
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Keep rejected background telemetry sends out of application error handlers during normal use and page teardown. Explicit flush and close calls still expose delivery failures to their callers.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
20
|
+
|
|
9
21
|
## 0.7.0-beta.25 — 2026-11-21
|
|
10
22
|
|
|
11
23
|
### 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,34 @@
|
|
|
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
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"changes": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "fixed",
|
|
23
|
+
"summary": "Keep rejected background telemetry sends out of application error handlers during normal use and page teardown. Explicit flush and close calls still expose delivery failures to their callers.",
|
|
24
|
+
"symbols": [
|
|
25
|
+
"createBeacon",
|
|
26
|
+
"BEACON_SDK_VERSION"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"date": "2026-11-22",
|
|
31
|
+
"version": "0.7.0-beta.26"
|
|
32
|
+
},
|
|
5
33
|
{
|
|
6
34
|
"changes": [
|
|
7
35
|
{
|
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") {
|
|
@@ -1306,7 +1306,7 @@ var createBeacon = (options) => {
|
|
|
1306
1306
|
type
|
|
1307
1307
|
};
|
|
1308
1308
|
};
|
|
1309
|
-
const
|
|
1309
|
+
const sendBuffered = async (useBeacon) => {
|
|
1310
1310
|
flushPendingNetworkFailures();
|
|
1311
1311
|
if (buffer.length === 0)
|
|
1312
1312
|
return;
|
|
@@ -1325,6 +1325,11 @@ var createBeacon = (options) => {
|
|
|
1325
1325
|
...options.key !== undefined ? { key: options.key } : {}
|
|
1326
1326
|
});
|
|
1327
1327
|
};
|
|
1328
|
+
const flush = (useBeacon = false) => {
|
|
1329
|
+
const delivery = sendBuffered(useBeacon);
|
|
1330
|
+
delivery.catch(() => {});
|
|
1331
|
+
return delivery;
|
|
1332
|
+
};
|
|
1328
1333
|
const addBreadcrumb = (crumb) => {
|
|
1329
1334
|
breadcrumbs.push({
|
|
1330
1335
|
at: Date.now(),
|
|
@@ -4050,8 +4055,10 @@ var createBeacon = (options) => {
|
|
|
4050
4055
|
const modalTimers = new Set;
|
|
4051
4056
|
const modalVisibility = new WeakMap;
|
|
4052
4057
|
const knownModals = new Set;
|
|
4053
|
-
const
|
|
4054
|
-
if (!modal.isConnected
|
|
4058
|
+
const isRenderedDialog = (modal) => {
|
|
4059
|
+
if (!modal.isConnected)
|
|
4060
|
+
return false;
|
|
4061
|
+
if (modal.localName === "dialog" && !modal.hasAttribute("open"))
|
|
4055
4062
|
return false;
|
|
4056
4063
|
let current = modal;
|
|
4057
4064
|
while (current !== null) {
|
|
@@ -4066,6 +4073,7 @@ var createBeacon = (options) => {
|
|
|
4066
4073
|
}
|
|
4067
4074
|
return true;
|
|
4068
4075
|
};
|
|
4076
|
+
const isRenderedModal = (modal) => modal.matches(MODAL_SELECTOR) && isRenderedDialog(modal);
|
|
4069
4077
|
const reportModalEscape = (modal, active, reason) => {
|
|
4070
4078
|
if (signals.modalFocusEscape === false || reportedModalEscapes.has(modal) || document.visibilityState === "hidden") {
|
|
4071
4079
|
return;
|
|
@@ -4127,31 +4135,60 @@ var createBeacon = (options) => {
|
|
|
4127
4135
|
}
|
|
4128
4136
|
};
|
|
4129
4137
|
const onFocusOut = (event) => {
|
|
4138
|
+
if (signals.focusLoss === false)
|
|
4139
|
+
return;
|
|
4130
4140
|
const target = event.target;
|
|
4131
4141
|
if (!(target instanceof Element))
|
|
4132
4142
|
return;
|
|
4133
4143
|
const dialog = target.closest(DIALOG_SELECTOR);
|
|
4134
4144
|
if (dialog === null)
|
|
4135
4145
|
return;
|
|
4146
|
+
const startedAt = performance.now();
|
|
4136
4147
|
const dialogDescriptor = describeElement(dialog);
|
|
4148
|
+
const descriptor = describeElement(target);
|
|
4137
4149
|
const focusEventTrusted = event.isTrusted === true;
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
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)
|
|
4142
4165
|
return;
|
|
4143
|
-
const descriptor = describeElement(target);
|
|
4144
4166
|
if (reportedFocusLoss.has(descriptor))
|
|
4145
4167
|
return;
|
|
4146
4168
|
reportedFocusLoss.add(descriptor);
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
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);
|
|
4154
4190
|
}, 0);
|
|
4191
|
+
modalTimers.add(timer);
|
|
4155
4192
|
};
|
|
4156
4193
|
document.addEventListener("focusin", onFocusIn, true);
|
|
4157
4194
|
document.addEventListener("focusout", onFocusOut, true);
|
|
@@ -5150,11 +5187,11 @@ var createBeacon = (options) => {
|
|
|
5150
5187
|
addBreadcrumb,
|
|
5151
5188
|
captureException,
|
|
5152
5189
|
captureMessage,
|
|
5153
|
-
close:
|
|
5190
|
+
close: () => {
|
|
5154
5191
|
closed = true;
|
|
5155
5192
|
for (const cleanup of cleanups.splice(0, cleanups.length))
|
|
5156
5193
|
cleanup();
|
|
5157
|
-
|
|
5194
|
+
return flush(true);
|
|
5158
5195
|
},
|
|
5159
5196
|
flush: () => flush(false),
|
|
5160
5197
|
observeCapability,
|
|
@@ -5193,5 +5230,5 @@ export {
|
|
|
5193
5230
|
redactBeaconEvent
|
|
5194
5231
|
};
|
|
5195
5232
|
|
|
5196
|
-
//# debugId=
|
|
5233
|
+
//# debugId=920DAD3D3853F68964756E2164756E21
|
|
5197
5234
|
//# sourceMappingURL=index.js.map
|