-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Render table in the shadow DOM for @finos/perspective-viewer-datagrid
#2482
Render table in the shadow DOM for @finos/perspective-viewer-datagrid
#2482
Conversation
0132c9f
to
f34bb03
Compare
@finos/perspective-viewer-datagrid
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.
Thanks for the PR! A couple of things need fixing:
- I'm ok with the configuration flag being a global static on the
perspective-viewer-datagrid
element, because there is no global settings feature yet, but one is obviously needed. However, let's please rename this toenableShadowDOM
. enableShadowDOM
should betrue
by default, e.g. we should default use the Shadow DOM. It looks like the examples work in this mode with this PR (👍 ), so no changes needed there. It is ok if the tests remain as Light DOM tests because they do some DOM surgery to check table elements, but ...- There needs to be at least a few tests added that test Shadow DOM mode specifically. If it's doable, I'd really like to see all the tests run in parameterized in both modes, but this may be a lot of work (?)
- The tests are currently failing regardless (looks like
perspective-jupyterlab
). - Let's remove the
examples/blocks
code which parses the URL.
packages/perspective-viewer-datagrid/src/js/custom_elements/datagrid.js
Outdated
Show resolved
Hide resolved
packages/perspective-viewer-datagrid/src/js/custom_elements/datagrid.js
Outdated
Show resolved
Hide resolved
Another API I was thinking about was sticking it as an attribute/flag on
I'll try this, it's a good idea to rerun the same tests with shadow DOM enabled/disabled. And I'll think about a test or two just for shadow DOM |
c57c0a0
to
83fe46c
Compare
@finos/perspective-viewer-datagrid
@finos/perspective-viewer-datagrid
fffed57
to
6e7b217
Compare
All the checks are passing now, re-review? |
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.
curious if you have any recommendations for quickly diffing these tarballs?
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.
Not sure what you mean. In theory, if the snapshots don't change, the tarball should be identical. We've added a few flags to the gzip process to force this to be the case regardless of things like file creation time.
I have noticed that this is not always the case, but I don't know why yet, nor have I even validated that this is an issue with the tarball or the actual files.
Move the `<regular-table>` element of datagrid into the shadow DOM by default. This change isolates the regular-table from global styles, so CSS rules on `regular-table` or `table` no longer affect datagrid. Style rules on the `regular-table` can be ported using the part named `regular-table` ``` // old style perspective-viewer-datagrid regular-table { font-family: "Comic Sans MS"; } // shadow dom perspective-viewer-datagrid::part(regular-table) { font-family: "Comic Sans MS"; } ``` To disable this feature and continue to use light DOM rendering, set: ``` HTMLPerspectiveViewerDatagridPluginElement.renderTarget = "light" ```
6e7b217
to
5b5624a
Compare
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.
Thanks for the PR! Looks good!
Hi, was this attribute flag ever exposed publicly? Looks like it is a static/private attribute set at runtime based on browser capaibility https://github.com/finos/perspective/blame/84605851230c3dd1cc58652b47babd04cc9fcc31/packages/perspective-viewer-datagrid/src/js/custom_elements/datagrid.js#L141 |
@jakehadar The inferred setting is a default. You can override it by using
|
Awesome, this is exactly what I need. Thank you for the quick response!
|
Move the
<regular-table>
element of datagrid into the shadow DOM by default.This change isolates the regular-table from global styles, so CSS rules on
regular-table
ortable
no longer affect datagrid. Style rules on theregular-table
can be ported using the part namedregular-table
To disable this feature and continue to use light DOM rendering, set: