question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with fullscreen feature with Web Component/Shadow DOM

See original GitHub issue

I created a custom element using openseadragon displayed in a <div> works perfectly as long as do not move the Image I can display Images sequences , collections and zoom in and out, but when move the image, it still works but is not displaye in the <div> anymore, it seems that it is reinjected somewhere else and displayed “fullpage” in the browser.


The togglebutton works but getting back is a complete mess

Here is a test page ( Zoomify tab )

http://prenomsfrancais.free.fr/showcase/s0.html

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
msalsberycommented, Jul 24, 2019

@PCailly

For what it’s worth, here’s an example of what has worked well for me across user agents. Never used in shadow DOM though, but I would expect my user agent to handle it correctly because, as we all know, all browsers act the same ;-D

Note: The important thing here is the extra OpenSeadragon DIV with width and height 100%. The DIV with the class “viewer-container” would be your DIV that has a height 100vh. Using two DIVs, one with overflow:hidden and one with width/height 100%, seems to contain the OpenSeadragon viewer correctly across all browsers I’ve tested

	<div class="viewer-container">
		<div id="osd" class="openseadragon"></div>
	</div>
.viewer-container
{
	/*
	this really should be something like calc(100vh - 90px)
	so the DIV doesn't extend outside the viewport
	*/
	height: 100vh;
	overflow: hidden;
}

.openseadragon
{
	height: 100%;
	width: 100%;
}
	var viewer = OpenSeadragon({
		id: 'osd',
		...
	});

If there’s dev tools with DOM element inspector available on the browser(s) it’s not working in, you should be able to see what element is covering the header row elements. I’d bet it’s the OpenSeadragon canvas…

1reaction
msalsberycommented, Jul 24, 2019

I agree that the 100vh trick is a hack

@PCailly

I don’t understand what the “trick” is. To me all that does is obscure (off the bottom of the viewport) part of the 100vh height element. You can see this on an iPhone, for example, which lets you scroll your vertically-oversized viewport (100vh + the heights of the two header rows) into view.

For the issue, the only thing that “should” be happening when you click or zoom on the image is either the OpenSeadragon canvas “moves” (drag/pan), or in the case of a click, it zooms which increases the canvas size. Depending on the user agent and/or your CSS/styles, the OpenSeadragon canvas change may be displayed over the top of neighbor elements. Have you tried setting the OpenSeadragon containing DIV’s overflow to hidden?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ShadowRoot.fullscreenElement - Web APIs - MDN Web Docs
The fullscreenElement read-only property of the ShadowRoot interface returns the element within the shadow tree that is currently displayed ...
Read more >
webkitfullscreenchange does not fire for shadow DOM elements
e.g. Added a regression test for making an element inside a shadow tree full screen, and listening to `webkitfullscreenchange` outside the shadow tree....
Read more >
Fullscreen modal styles not extending beyond shadow DOM
I'm attempting to create a fullscreen modal within my shadow DOM custom element, but it seems that the styling for it doesn't extend...
Read more >
Allow External Styling of a Web Component's Shadow DOM
The Shadow DOM protects your components from style conflicts. The same protection also makes it hard for users to modify the inner style...
Read more >
How to Fullscreen a Specific Element in a Web Page
document.fullscreenElement/ShadowRoot.fullscreenElement : This property returns the content displayed in fullscreen mode on the current DOM (or shadow DOM), or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found