feat: Popover element handling via pseudoClassEnabledElements and selectors#2141
feat: Popover element handling via pseudoClassEnabledElements and selectors#2141Manoj-Katta wants to merge 7 commits intomasterfrom
Conversation
…seudo-class serialization
…e to 'true' and enhance tests
There was a problem hiding this comment.
Pull request overview
This PR updates Percy’s DOM pseudo-class serialization pipeline to support HTML popover elements and adds a new selector-based targeting mechanism in pseudoClassEnabledElements.
Changes:
- Add
selector: string[]to thepseudoClassEnabledElementsconfig schema for CSS selector-based targeting. - Extend pseudo-class element marking to also stamp a popover reconstruction attribute (
data-percy-popover-open). - Add tests for popover stamping and the new selector-based targeting branch.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/dom/src/serialize-pseudo-classes.js | Adds popover stamping during marking and implements selector-based element collection. |
| packages/core/src/config.js | Extends config schema to allow pseudoClassEnabledElements.selector. |
| packages/dom/test/serialize-pseudo-classes.test.js | Adds tests for popover handling and selector matching/warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…d on popover state and improve tests
There was a problem hiding this comment.
Pull request overview
Enhances Percy’s DOM serialization to better support HTML popover elements and expands pseudo-class element targeting by adding CSS selector-based configuration.
Changes:
- Stamp a
data-percy-popover-open="true"attribute on elements that are currently:popover-openduring pseudo-class element marking. - Add
selector: string[]support topseudoClassEnabledElementsconfig and process matching elements viaquerySelectorAll. - Add/extend tests for popover stamping and selector-based matching.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/dom/src/serialize-pseudo-classes.js | Adds popover-open detection/stamping and selector-based element discovery for pseudo-class processing. |
| packages/core/src/config.js | Extends config schema for pseudoClassEnabledElements with a selector array. |
| packages/dom/test/serialize-pseudo-classes.test.js | Adds tests covering popover stamping behavior and selector handling, including invalid selector warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…mprove attribute stamping logic
There was a problem hiding this comment.
Pull request overview
This PR updates Percy’s DOM pseudo-class serialization flow to better support native HTML popovers by marking open popover elements for renderer-side restoration, and expands pseudoClassEnabledElements targeting to include CSS selectors.
Changes:
- Stamp a
data-percy-popover-open="true"attribute on elements that are popovers and currently:popover-open. - Add
selector: string[]support topseudoClassEnabledElements, enabling CSS selector-based targeting. - Extend the DOM unit tests to cover popover stamping and selector-based element matching/warnings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/dom/src/serialize-pseudo-classes.js | Adds popover-open detection/stamping and selector-based element discovery. |
| packages/core/src/config.js | Extends config schema to allow pseudoClassEnabledElements.selector. |
| packages/dom/test/serialize-pseudo-classes.test.js | Adds tests for popover marking behavior and selector handling (including invalid/no-match cases). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } catch (err) { | ||
| console.warn(`Invalid selector "${selector}". Error: ${err.message}`); | ||
| } |
…ector in markPseudoClassElements
Summary
This PR enhances Percy's DOM serialization to properly handle HTML popover elements by introducing new configuration options and stamping attributes for renderer reconstruction.
What's Changed
New Features
Implementation Details
Core Logic (packages/dom/src/serialize-pseudo-classes.js)
Testing (packages/dom/test/serialize-pseudo-classes.test.js)
Jira: https://browserstack.atlassian.net/browse/PPLT-5016