Comments (11)
Hey @minhtranite thanks for the info. Looks easy enough to sort. Will look into it!
from resize-observer.
Hey @JayaKrishnaNamburu yep there is a bug here. So many ways to create and take ownership of elements :)
from resize-observer.
Great! I'm not sure if you've looked at the code yet but it's probably best to just test if el instanceof Element
first and return. If not, continue to try and find the document/window scope. This is the current issue for your use case, as the util cannot find out what the defaultView
is.
from resize-observer.
Hi @JayaKrishnaNamburu your problem on the demo above easy to fix by use iframe document to create element instead of top windown document.
The demo for the fix: https://codesandbox.io/s/observer-330-forked-39xy9?file=/src/App.tsx
from resize-observer.
This has another issue where the document has no listeners for observation, so the observation is only noticed when the scheduler is run in the main document. This could also be fixed with changes from #42
from resize-observer.
@minhtranite as a workaround for now, you can propagate the events to the parent window. It's pretty nasty, but will get it working 😬
Here is an example based on your sample
// boxEl exists in an IFrame
this.boxEl.addEventListener('keydown', (e) => {
const event = new Event(e.type, e); // proxy event
event.preventDefault(); // try not to do anything unexpected
window.dispatchEvent(event); // dispatch in main window
});
from resize-observer.
Hi @TremayneChrist thanks for the great package 🎉,
I am using this for sometime. But, when i upgraded from 2.3.0
to 3.3.0
the isElement
check breaks for me. The main difference i can find from the above codesandbox example in description to my use-case is
Example above uses a ReactPortal to render the data, where in this case the portals
use iframe just as a kind of placeholder to render stuff. But managed by React. But when we create a DOM element and try to add to the iframe. That's when the check breaks.
Here is the same example with two different checks with different versions
@juggle/[email protected]
-> https://codesandbox.io/s/observer-330-ucif1
@juggle/[email protected]
-> https://codesandbox.io/s/observer-230-vl0gi
from resize-observer.
Yes agreed, I will try to take a look if i can fix this check for both the use-cases and general use-case in common 😄
from resize-observer.
Just seen your PR :)
from resize-observer.
Great! I'm not sure if you've looked at the code yet but it's probably best to just test if
el instanceof Element
first and return. If not, continue to try and find the document/window scope. This is the current issue for your use case, as the util cannot find out what thedefaultView
is.
Yes yes, do you think the PR is a valid fix ? or can i close it :)
from resize-observer.
Yes, and this behaviour is only in chrome alone 😄
from resize-observer.
Related Issues (20)
- Refactor and reduce code to allow for a smaller bundle size HOT 1
- ResizeObserver loop completed with undelivered notifications HOT 13
- .disconnect() breaks additional observe calls HOT 1
- Using this polyfill with polyfill.io HOT 4
- Improve code hints
- covering more cases HOT 10
- The UMD build doesn't not export the globals as expected HOT 5
- ResizeObserver loop completed with undelivered notifications (native works fine) HOT 13
- Improve the accuracy of device-pixel-content-box when moving elements across pixels
- Imports must specify file extension when "type": "module" HOT 4
- [Question] - How does this package compares with que-etc/resize-observer-polyfill ? HOT 3
- Missing null check HOT 3
- [spec] lastReportedSize should initialise with (-1, -1) HOT 1
- ResizeObserverEntry type does not match actual payload when using Safari versions 15.3.1 and older HOT 1
- the >>> and /deep/ combinators have been deprecated. Use :deep() instead HOT 1
- ResizeObserver loop completed with undelivered notifications. HOT 2
- Inconsistent anchoring in regex HOT 1
- import question HOT 5
- Update readme to point to public working draft HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resize-observer.