@adobe/helix-rum-enhancer 2.30.0 → 2.30.2

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.30.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.1...v2.30.2) (2025-01-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * do not trigger fill checkpoint for hidden fields ([f6f4c51](https://github.com/adobe/helix-rum-enhancer/commit/f6f4c519d38c48740ace4ba64f47cafc6cea2f47))
7
+
8
+ ## [2.30.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.0...v2.30.1) (2025-01-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * form elements having name/id as id breaks the sourceSelector logic. ([37bd0ab](https://github.com/adobe/helix-rum-enhancer/commit/37bd0ab4c6bb1aac1326bc9be0097a7ccf038870))
14
+
1
15
  # [2.30.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.29.0...v2.30.0) (2025-01-15)
2
16
 
3
17
 
package/README.md CHANGED
@@ -62,10 +62,6 @@ All three parts are optional
62
62
  Even if an `identifier` is provided, having a `context` and `element` is recommended, as it makes the `source` parameter more readable and easier to understand.
63
63
 
64
64
 
65
- #### Examples
66
-
67
- - ``
68
-
69
65
  ## Development
70
66
 
71
67
  ### Build
@@ -85,3 +81,6 @@ $ npm test
85
81
  ```bash
86
82
  $ npm run lint
87
83
  ```
84
+ ### Cutting a Pre-Release
85
+
86
+ Releases are handled by [semantic-release](https://github.com/semantic-release/semantic-release), and will happen automatically when a PR is merged into the `main` or the `1.x` branch. By merging into `beta`, a pre-release will be created.
package/modules/dom.js CHANGED
@@ -41,12 +41,10 @@ function isDialog(el) {
41
41
  // doing it well
42
42
  if (el.tagName === 'DIALOG') return true;
43
43
  // making the best of it
44
- if (el.getAttribute('role') === 'dialog') return true;
45
- if (el.getAttribute('role') === 'alertdialog') return true;
46
- if (el.getAttribute('aria-modal') === 'true') return true;
47
- // doing it wrong
48
44
  const cs = window.getComputedStyle(el);
49
- return (cs && cs.position === 'fixed' && cs.zIndex > 100);
45
+ return ['dialog', 'alertdialog'].find((r) => el.getAttribute('role') === r)
46
+ || el.getAttribute('aria-modal') === 'true'
47
+ || (cs && cs.position === 'fixed' && cs.zIndex > 100);
50
48
  }
51
49
 
52
50
  function isButton(el) {
@@ -62,16 +60,14 @@ function isButton(el) {
62
60
  function getSourceContext(el) {
63
61
  const formEl = el.closest('form');
64
62
  if (formEl) {
65
- return `form${formEl.id ? `#${formEl.id}` : ''}`;
63
+ const id = formEl.getAttribute('id');
64
+ return `form${id ? `#${id}` : ''}`;
66
65
  }
67
66
  const block = el.closest('.block[data-block-name]');
68
- if (block) return `.${block.getAttribute('data-block-name')}`;
69
- if (walk(el, isDialog)) return 'dialog';
70
- if (el.closest('nav')) return 'nav';
71
- if (el.closest('header')) return 'header';
72
- if (el.closest('footer')) return 'footer';
73
- if (el.closest('aside')) return 'aside';
74
- return (walk(el, (e) => e.id && `#${e.id}`));
67
+ return ((block && `.${block.getAttribute('data-block-name')}`)
68
+ || (walk(el, isDialog) && 'dialog')
69
+ || ['nav', 'header', 'footer', 'aside'].find((t) => el.closest(t))
70
+ || walk(el, (e) => e.id && `#${e.id}`));
75
71
  }
76
72
 
77
73
  function getSourceElement(el) {
package/modules/index.js CHANGED
@@ -258,10 +258,12 @@ function addFormTracking(parent) {
258
258
  form.addEventListener('submit', (e) => sampleRUM('formsubmit', { target: targetSelector(e.target), source: sourceSelector(e.target) }), { once: true });
259
259
  let lastSource;
260
260
  form.addEventListener('change', (e) => {
261
- const source = sourceSelector(e.target);
262
- if (source !== lastSource) {
263
- sampleRUM('fill', { source });
264
- lastSource = source;
261
+ if (e.target.checkVisibility()) {
262
+ const source = sourceSelector(e.target);
263
+ if (source !== lastSource) {
264
+ sampleRUM('fill', { source });
265
+ lastSource = source;
266
+ }
265
267
  }
266
268
  });
267
269
  form.addEventListener('focusin', (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.30.0",
3
+ "version": "2.30.2",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -63,11 +63,10 @@
63
63
  }
64
64
  function isDialog(el) {
65
65
  if (el.tagName === 'DIALOG') return true;
66
- if (el.getAttribute('role') === 'dialog') return true;
67
- if (el.getAttribute('role') === 'alertdialog') return true;
68
- if (el.getAttribute('aria-modal') === 'true') return true;
69
66
  const cs = window.getComputedStyle(el);
70
- return (cs && cs.position === 'fixed' && cs.zIndex > 100);
67
+ return ['dialog', 'alertdialog'].find((r) => el.getAttribute('role') === r)
68
+ || el.getAttribute('aria-modal') === 'true'
69
+ || (cs && cs.position === 'fixed' && cs.zIndex > 100);
71
70
  }
72
71
  function isButton(el) {
73
72
  if (el.tagName === 'BUTTON') return true;
@@ -81,16 +80,14 @@
81
80
  function getSourceContext(el) {
82
81
  const formEl = el.closest('form');
83
82
  if (formEl) {
84
- return `form${formEl.id ? `#${formEl.id}` : ''}`;
83
+ const id = formEl.getAttribute('id');
84
+ return `form${id ? `#${id}` : ''}`;
85
85
  }
86
86
  const block = el.closest('.block[data-block-name]');
87
- if (block) return `.${block.getAttribute('data-block-name')}`;
88
- if (walk(el, isDialog)) return 'dialog';
89
- if (el.closest('nav')) return 'nav';
90
- if (el.closest('header')) return 'header';
91
- if (el.closest('footer')) return 'footer';
92
- if (el.closest('aside')) return 'aside';
93
- return (walk(el, (e) => e.id && `#${e.id}`));
87
+ return ((block && `.${block.getAttribute('data-block-name')}`)
88
+ || (walk(el, isDialog) && 'dialog')
89
+ || ['nav', 'header', 'footer', 'aside'].find((t) => el.closest(t))
90
+ || walk(el, (e) => e.id && `#${e.id}`));
94
91
  }
95
92
  function getSourceElement(el) {
96
93
  const f = el.closest('form');
@@ -390,10 +387,12 @@
390
387
  form.addEventListener('submit', (e) => sampleRUM('formsubmit', { target: targetSelector(e.target), source: sourceSelector(e.target) }), { once: true });
391
388
  let lastSource;
392
389
  form.addEventListener('change', (e) => {
393
- const source = sourceSelector(e.target);
394
- if (source !== lastSource) {
395
- sampleRUM('fill', { source });
396
- lastSource = source;
390
+ if (e.target.checkVisibility()) {
391
+ const source = sourceSelector(e.target);
392
+ if (source !== lastSource) {
393
+ sampleRUM('fill', { source });
394
+ lastSource = source;
395
+ }
397
396
  }
398
397
  });
399
398
  form.addEventListener('focusin', (e) => {
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 5424a86261f2304969b6951549ac3941
1
+ 389f38e9847798177fc9bd3f8f9b763b