Skip to content
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

Error when reference strip used with Shadow DOM #1674

Closed
dmcalpin opened this issue Jul 11, 2019 · 5 comments
Closed

Error when reference strip used with Shadow DOM #1674

dmcalpin opened this issue Jul 11, 2019 · 5 comments

Comments

@dmcalpin
Copy link
Contributor

When including a viewer inside a web component (with Shadow DOM), with a reference strip enabled, i get the error: TypeError: Cannot read property 'style' of null and the selected thumbnail in the reference strip is not highlighted

Error Example: https://jsbin.com/beyunawuhu/1/edit?js,output

it looks like this is due to the $.getElement call here:

var element = $.getElement( this.element.id + '-' + page ),

would it be possible to do something like this:
$.getElement( this.element.children[page] )
so that it's scoped to the element, instead of the light dom

(sry, im not very familiar with your codebase)

@iangilman
Copy link
Member

I'm not familiar with working with the shadow DOM, so I guess we'll have to meet in the middle somehow!

Would this work?

var element = this.element.querySelector(this.element.id + '-' + page)

That way we can stick with the ID structure.

@dmcalpin
Copy link
Contributor Author

I'm all for meeting in the middle. Just tested my app, works good
var element = this.element.querySelector('#' + this.element.id + '-' + page)
i'll get a PR opened if that sounds good to you

@PCailly
Copy link

PCailly commented Jul 17, 2019

I solved this by passindg th element instead.
this._rootDiv = document.createElement ( "div");
this.shadow.appendChild(this._rootDiv);

THEN
OpenSeadragon({
element: this._rootDiv,

        tileSources:  xxxxx

});

BUT
I got the 'move' and 'fulscreen' BUGS as described in my post CustomElements

@dmcalpin
Copy link
Contributor Author

@PCailly i did the same thing. Passing HTML Elements for element, or the different buttons zoomInButton worked well. But the reference strip doesn't allow for that which is why we end up with this error

@msalsbery
Copy link
Member

Closing this...feel free to re-open if issues persist!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants