-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use shadow dom to render the toolbar #2266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
f3afad0 to
46c901e
Compare
tim-schilling
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh dang, this was a much simpler implementation than I expected. Thank you @federicobond!
I think we may want to make a mention of how to fetch JS elements in the JavaScript documentation somewhere. I'm going to assume, this will also impact any third-party panels that have some JS that looks for elements in the DOM? That may make things a bit tricky to support backwards compatibility for a version or two 🤔 What do you think?
dbebd08 to
fec6a73
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
@tim-schilling I think we could take this approach: Phase 1: Update the built-in JS in this version to support both approaches and add a note for custom panel developers to query elements from the root using the new Phase 2: Make Shadow DOM the default but allow users to opt-out if they experience broken custom panels. This would give panel developers plenty of time to make their panels compatible with a shadow DOM toolbar and allow us to get feedback from early adopters. |
Description
Following the discussion on #2007, I started experimenting with shadow DOM and it turns out it's pretty easy to make it work with the debug toolbar.
Most of the changes are related to getting the correct root for querying elements in JS, and those could be extracted to a separate pull request to make it easy to review the changes specific to shadow DOM.
The only change required for custom panels is that they should access the root debug element via the
getDebugElementfunction inutils.jsinstead of directly querying#djDebug, and they should perform all element queries from that root.This change effectively isolates the Debug Toolbar styles from the rest of the page, which would make it easier to implement all sorts of utility classes for more advanced panel styling.
Checklist:
docs/changes.rst.