dash-extensions icon indicating copy to clipboard operation
dash-extensions copied to clipboard

`EventListener` support for the `resize` event?

Open hannahker opened this issue 2 years ago • 4 comments

I'd like to capture the window resize event using the EventListener component to help with creating a responsive app layout. To do this I've added the EventListener to my layout:

EventListener(id="event-listener", events=[{"event": "resize", "props": []}]) 

This does not trigger any callbacks, which I'm assuming is because this event does not bubble, or because it's not possible to capture events from the Window object? Is there a possible workaround here?

hannahker avatar Aug 25 '23 20:08 hannahker

Potentially related to #255

hannahker avatar Aug 25 '23 20:08 hannahker

I have added support in the latest 1.0.11 release. Could you test if it works as intended?

emilhe avatar Feb 03 '24 11:02 emilhe

Wouldn't this be only a side effect of the EventListener attaching to document instead of window?

https://github.com/emilhe/dash-extensions/blob/7e4048ffa468bf1e42923d5a8398d72560824698/src/lib/components/EventListener.react.js#L21

fgoudreault avatar Mar 04 '25 22:03 fgoudreault

Thanks for the reminder on this one. I'm no longer working with Plotly and so not in a position to test this anymore. Perhaps of interest to @cleaaum!

hannahker avatar Mar 04 '25 23:03 hannahker