fix(plugin-autocapture-browser): fix nearest label CSS coping - #1964
Open
daniel-graham-amplitude wants to merge 1 commit into
Open
fix(plugin-autocapture-browser): fix nearest label CSS coping#1964daniel-graham-amplitude wants to merge 1 commit into
daniel-graham-amplitude wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Regression test expects wrong label
- Nested the page-title h1 under a header so the fixture exercises unscoped descendant matching instead of a sibling :scope>h1 hit.
Or push these changes by commenting:
@cursor push a728934667
Preview (a728934667)
diff --git a/packages/plugin-autocapture-browser/test/data-extractor.test.ts b/packages/plugin-autocapture-browser/test/data-extractor.test.ts
--- a/packages/plugin-autocapture-browser/test/data-extractor.test.ts
+++ b/packages/plugin-autocapture-browser/test/data-extractor.test.ts
@@ -472,11 +472,13 @@
// the parent. Walking up then picks the first ancestor that contains any
// heading — e.g. a page title — instead of a sibling label.
const container = document.createElement('div');
+ const header = document.createElement('header');
const heading = document.createElement('h1');
heading.innerText = 'My App';
const form = document.createElement('form');
const input = document.createElement('input');
- container.appendChild(heading);
+ header.appendChild(heading);
+ container.appendChild(header);
form.appendChild(input);
container.appendChild(form);You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 7a19102. Configure here.
size-limit report 📦
|
daniel-graham-amplitude
force-pushed
the
SDK-229-fix-nearest-label
branch
from
August 31, 2026 17:23
7a19102 to
346f9ef
Compare
daniel-graham-amplitude
force-pushed
the
SDK-229-fix-nearest-label
branch
from
September 3, 2026 17:03
346f9ef to
fbff3f3
Compare
Mercy811
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Checklist
Note
Low Risk
Small DOM-query change in autocapture label enrichment only; improves event property accuracy with no auth or data-pipeline impact.
Overview
getNearestLabelin the autocapture browser plugin now applies:scope>to each heading selector (h1–h6), not only tospan. Previously, headings in the compound selector could match any descendant of the current parent, so nested headings could be picked as[Amplitude] Element Parent Labelwhen walking up the DOM.A regression test covers a form input under a layout where a page-level
h1is not a direct child label of the input’s immediate ancestors, expecting an empty parent label.Reviewed by Cursor Bugbot for commit fbff3f3. Bugbot is set up for automated code reviews on this repo. Configure here.