feat: Add shadow DOM support to ANDI#275
Draft
jasonday wants to merge 6 commits intoSSAgov:masterfrom
Draft
Conversation
This change updates the ANDI bookmarklet to correctly identify and inspect elements located within a shadow DOM. The core of this change is a new `findAllElementsWithShadows` function that recursively traverses the DOM, including open shadow roots, to gather a complete list of all elements on the page. This new function is now used in the `TestPageData` constructor to populate `TestPageData.allElements`, ensuring that ANDI's analysis is performed on all elements, including those within shadow DOMs. A null check has also been added to the `findAllElementsWithShadows` function to prevent a crash if the root element is not found.
Add shadow DOM support to ANDI - Proof of concept. There are still some things not being reported, but it is returning information about elements within the shadow DOM. See screenshots in comments.
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.
Caution
This pull request is for informative purposes/communication only.
Proof of concept for adding Shadow DOM support to ANDI. I have not ironed out all of the kinks, but do have ANDI providing information about elements (such as form fields) within shadow roots. I haven't tested across all ANDI functionality, nor all types of shadow DOM components.
Testing
URL
https://staging.va.gov/mock-form-patterns/name-and-date-of-birth
shadow DOM component
ANDI-update screenshot