@spotify-confidence/csr-recorder 0.17.13 → 0.17.14

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,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.17.14](https://github.com/spotify/confidence-sdk-js/compare/csr-recorder-v0.17.13...csr-recorder-v0.17.14) (2026-08-20)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * **csr-recorder:** preserve native click modifiers ([#440](https://github.com/spotify/confidence-sdk-js/issues/440)) ([9575f1a](https://github.com/spotify/confidence-sdk-js/commit/9575f1a915a1a71ae16b1bd59053085d2456b0da))
9
+
3
10
  ## [0.17.13](https://github.com/spotify/confidence-sdk-js/compare/csr-recorder-v0.17.12...csr-recorder-v0.17.13) (2026-08-18)
4
11
 
5
12
 
package/dist/index.cjs CHANGED
@@ -11127,16 +11127,17 @@ function clickModifiersPlugin() {
11127
11127
  observer: (_callback, win) => {
11128
11128
  const onClick = (event) => {
11129
11129
  const click = event;
11130
- pendingClick = {
11130
+ const modifiers = {
11131
11131
  button: click.button,
11132
11132
  altKey: click.altKey,
11133
11133
  ctrlKey: click.ctrlKey,
11134
11134
  metaKey: click.metaKey,
11135
11135
  shiftKey: click.shiftKey
11136
11136
  };
11137
- queueMicrotask(() => {
11138
- pendingClick = null;
11139
- });
11137
+ pendingClick = modifiers;
11138
+ win.setTimeout(() => {
11139
+ if (pendingClick === modifiers) pendingClick = null;
11140
+ }, 0);
11140
11141
  };
11141
11142
  win.addEventListener("click", onClick, true);
11142
11143
  return () => win.removeEventListener("click", onClick, true);
package/dist/index.js CHANGED
@@ -11126,16 +11126,17 @@ function clickModifiersPlugin() {
11126
11126
  observer: (_callback, win) => {
11127
11127
  const onClick = (event) => {
11128
11128
  const click = event;
11129
- pendingClick = {
11129
+ const modifiers = {
11130
11130
  button: click.button,
11131
11131
  altKey: click.altKey,
11132
11132
  ctrlKey: click.ctrlKey,
11133
11133
  metaKey: click.metaKey,
11134
11134
  shiftKey: click.shiftKey
11135
11135
  };
11136
- queueMicrotask(() => {
11137
- pendingClick = null;
11138
- });
11136
+ pendingClick = modifiers;
11137
+ win.setTimeout(() => {
11138
+ if (pendingClick === modifiers) pendingClick = null;
11139
+ }, 0);
11139
11140
  };
11140
11141
  win.addEventListener("click", onClick, true);
11141
11142
  return () => win.removeEventListener("click", onClick, true);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotify-confidence/csr-recorder",
3
3
  "license": "Apache-2.0",
4
- "version": "0.17.13",
4
+ "version": "0.17.14",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/spotify/confidence-sdk-js.git",
@@ -64,7 +64,7 @@ describe('RrwebEngine', () => {
64
64
  expect(recordSpy.mock.calls[0][0].slimDOMOptions).toBe('all');
65
65
  });
66
66
 
67
- it('adds native click modifier keys to the rrweb click event', () => {
67
+ it('keeps native click modifiers through a browser microtask checkpoint', async () => {
68
68
  new RrwebEngine().start({}, () => {});
69
69
  const plugin = recordSpy.mock.calls[0][0].plugins.find(
70
70
  ({ name }: { name: string }) => name === 'csr/click-modifiers@1',
@@ -80,6 +80,9 @@ describe('RrwebEngine', () => {
80
80
  shiftKey: true,
81
81
  }),
82
82
  );
83
+ // Browsers can run a microtask checkpoint between the window capture
84
+ // listener above and rrweb's document listener for a trusted click.
85
+ await Promise.resolve();
83
86
 
84
87
  expect(
85
88
  plugin.eventProcessor({
@@ -114,7 +117,7 @@ describe('RrwebEngine', () => {
114
117
  );
115
118
  const removeObserver = plugin.observer(() => {}, window);
116
119
  document.dispatchEvent(new MouseEvent('click', { metaKey: true }));
117
- await Promise.resolve();
120
+ await new Promise(resolve => window.setTimeout(resolve, 0));
118
121
 
119
122
  const event = {
120
123
  type: 3,
@@ -24,16 +24,17 @@ function clickModifiersPlugin(): RrwebPlugin {
24
24
  observer: (_callback, win) => {
25
25
  const onClick = (event: Event) => {
26
26
  const click = event as MouseEvent;
27
- pendingClick = {
27
+ const modifiers = {
28
28
  button: click.button,
29
29
  altKey: click.altKey,
30
30
  ctrlKey: click.ctrlKey,
31
31
  metaKey: click.metaKey,
32
32
  shiftKey: click.shiftKey,
33
33
  };
34
- queueMicrotask(() => {
35
- pendingClick = null;
36
- });
34
+ pendingClick = modifiers;
35
+ win.setTimeout(() => {
36
+ if (pendingClick === modifiers) pendingClick = null;
37
+ }, 0);
37
38
  };
38
39
 
39
40
  win.addEventListener('click', onClick, true);