Support iframes
See original GitHub issue🚀 Feature request
Motivation
Hello there, I am evaluating Reakit to figure out if we can use it at work and one constraint we have is that we render our React application inside of an iframe and that when app code uses globals like document
, these should be the iframe’s.
Example
This is one of the many examples:
Here you are referencing the global document. The fix here is easy enough:
export function hasFocusWithin(element: Element) {
const activeElement = element.ownerDocument.activeElement
if (!activeElement) return false;
return element.contains(activeElement);
}
Possible implementations
Basically every time you reference document
or window
etc you’d need it to get it from an element (ref?) within the frame. Probably another option is to provide those globals via context.
Thanks in advance for your time, and thank you for the library it looks promising!
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
"iframe" | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more ><iframe>: The Inline Frame element - HTML - MDN Web Docs
The <iframe> HTML element represents a nested browsing context, embedding another ... If a browser does not support the srcdoc attribute, ...
Read more >HTML iframe tag - W3Schools
The <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document.
Read more >5 Best Browsers that Support iFrame [Ranked by Consistency]
What are the best browsers that support iFrame? · Opera – Comes with built-in VPN · Opera · Google Chrome – Popular choice...
Read more >The ultimate guide to iframes - LogRocket Blog
Not a fan of iframes? This post provides an overview of the tag's best features, shows you how to use them, and how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Some progress has been made on this. There are still these lines to update:
https://github.com/reakit/reakit/blob/49db6c007ea82fddf959448328b5f5d572defa40/packages/reakit/src/Portal/Portal.tsx#L13
https://github.com/reakit/reakit/blob/49db6c007ea82fddf959448328b5f5d572defa40/packages/reakit/src/Portal/Portal.tsx#L27
Only
Portal
left now! I’m not sure what to do with that asdocument
is assigned at the module’s top-level scope.Maybe just let people use
PortalContext.Provider
and pass their own container element.