Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions OUTPUT-EXAMPLE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Result Example
# Output Example

JSON example containing all possible step types produced by the sequence recorder.

Expand Down Expand Up @@ -124,6 +124,14 @@ JSON example containing all possible step types produced by the sequence recorde
"type": "click",
"value": "Submit",
"frame": "#content-iframe"
},
{
"timestamp": 1718724013000,
"css": ".nested-btn",
"xpath": "/html/body/div/button",
"type": "click",
"value": "Confirm",
"frame": "#outer-iframe >>> #inner-iframe"
}
]
```
Expand Down Expand Up @@ -153,4 +161,4 @@ JSON example containing all possible step types produced by the sequence recorde
| `xpath` | XPath selector for the target element |
| `type` | Event type identifier |
| `value` | Element value or trimmed text content (max 20 chars for clicks) |
| `frame` | CSS selector of the containing iframe, empty string if top-level |
| `frame` | CSS selector of the containing iframe, empty string if top-level. For nested iframes, selectors are joined with ` >>> ` from outermost to innermost (e.g. `#outer-iframe >>> #inner-iframe`) |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snyk-api-and-web-record-sequence",
"version": "1.2.0",
"version": "1.2.2",
"description": "Snyk API & Web Record login/sequence",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest-firefox.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Snyk API & Web Sequence Recorder",
"version": "1.2.0",
"version": "1.2.2",
"browser_specific_settings": {
"gecko": {
"id": "sequence-recorder@probely.com",
Expand Down
26 changes: 21 additions & 5 deletions src/pages/Content/modules/collectEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,27 @@ export function interceptEvents(event, doc, ifrSelector, callback) {
) {
return;
}
if (nodeName === 'label') {
const forAttr = tgt.getAttribute('for');
if (forAttr && document.getElementById(forAttr)) {
// can be ignored... will fire checkbox
return;
const parentLabel = tgt.closest && tgt.closest('label');
if (parentLabel) {
// Only suppress when the click is actually forwarded to the labeled control.
// Clicks on interactive descendants (links, buttons, other fields) are NOT
// forwarded by the browser and must still be recorded.
const interactiveHit = tgt.closest('a, button, input, select, textarea');
const forwardsToControl = !interactiveHit || !parentLabel.contains(interactiveHit);
if (forwardsToControl) {
const forAttr = parentLabel.getAttribute('for');
if (forAttr) {
const root = tgt.getRootNode();
const lookup = root && root.getElementById ? root : document; // shadow-DOM safe
const forEl = lookup.getElementById(forAttr);
if (forEl && forEl.nodeName.toLowerCase() === 'input' &&
(forEl.type === 'checkbox' || forEl.type === 'radio')) {
return;
}
}
if (parentLabel.querySelector('input[type="checkbox"], input[type="radio"]')) {
return;
}
}
}
let typeStr = 'click';
Expand Down
2 changes: 1 addition & 1 deletion test-build-firefox/contentScript.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test-build-firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Snyk API & Web Sequence Recorder",
"version": "1.2.0",
"version": "1.2.2",
"browser_specific_settings": {
"gecko": {
"id": "sequence-recorder@probely.com",
Expand Down
2 changes: 1 addition & 1 deletion test-build/contentScript.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test-build/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.2.0","manifest_version":3,"name":"Snyk API & Web Sequence Recorder","action":{"default_popup":"popup.html","default_icon":{"16":"icon-34.png","48":"icon-48.png"}},"icons":{"128":"icon-128.png"},"background":{"service_worker":"background.bundle.js"},"content_scripts":[{"matches":["http://*/*","https://*/*"],"js":["contentScript.bundle.js"],"css":["content.styles.css"],"run_at":"document_start","all_frames":true,"match_about_blank":true}],"web_accessible_resources":[{"resources":["content.styles.css","icon-128.png","icon-34.png"],"matches":["<all_urls>"]}],"permissions":["storage","activeTab"],"host_permissions":["http://*/*","https://*/*"]}
{"version":"1.2.2","manifest_version":3,"name":"Snyk API & Web Sequence Recorder","action":{"default_popup":"popup.html","default_icon":{"16":"icon-34.png","48":"icon-48.png"}},"icons":{"128":"icon-128.png"},"background":{"service_worker":"background.bundle.js"},"content_scripts":[{"matches":["http://*/*","https://*/*"],"js":["contentScript.bundle.js"],"css":["content.styles.css"],"run_at":"document_start","all_frames":true,"match_about_blank":true}],"web_accessible_resources":[{"resources":["content.styles.css","icon-128.png","icon-34.png"],"matches":["<all_urls>"]}],"permissions":["storage","activeTab"],"host_permissions":["http://*/*","https://*/*"]}
Loading