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

Floating tab groups move in nested dockview #344

Closed
michaelsharpe opened this issue Sep 28, 2023 · 11 comments · Fixed by #346
Closed

Floating tab groups move in nested dockview #344

michaelsharpe opened this issue Sep 28, 2023 · 11 comments · Fixed by #346
Labels
bug Something isn't working next release
Milestone

Comments

@michaelsharpe
Copy link

michaelsharpe commented Sep 28, 2023

Describe the bug
I am using nested dockviews. I have one controlling a tab system, and within the tab there are workspaces with tab windows. When I pop a group out and position it, switch parent tabs, and come back, the floating group is moved to the top right corner.

To Reproduce
This issue can be reproduced directly on the nested dockview demo on the site here https://dockview.dev/docs/components/dockview#nested-dockviews.

Steps to reproduce the behavior:

  1. Go to https://dockview.dev/docs/components/dockview#nested-dockviews
  2. Move the parent tabs into the same tab bar.
  3. Pop out one of the tabs of the child and move it somewhere
  4. Switch tabs
  5. Return back to tab with nested dockview.

Expected behavior
Floating tab groups should stay where they are placed.

Screenshots

Screen.Recording.2023-09-28.at.3.30.16.PM.mov

Desktop (please complete the following information):

  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@mathuo
Copy link
Owner

mathuo commented Sep 29, 2023

Nice find - thank you!

I've taken a look into this and the explaination is something like...

dockview dispatches most resize events through requestAnimationFrame calls for performance reasons. This means that the actual resize call doesn't necessarily happen immediately and in this case the callback isn't called until after the nested dockview has been unmounted from the DOM to make way for the newly focused panel. Since that element is no longer attached to the DOM when the internal resizing logic goes to measure this component it measures as zero in both dimensions and position causing the resetting of the floating panels position to the top left (0, 0).

To fix this issue the resizing logic should check that the element it is measuring is actually still present in the DOM and if it is not skip the resize call.

@mathuo mathuo linked a pull request Sep 29, 2023 that will close this issue
@mathuo mathuo added bug Something isn't working next release labels Sep 29, 2023
@mathuo mathuo changed the title Floating tab groups move in bested dockview Floating tab groups move in nested dockview Sep 30, 2023
@mathuo mathuo added this to the v1.8.4 milestone Sep 30, 2023
@michaelsharpe
Copy link
Author

Thanks for the explanation! Stoked for this to be working. This is perhaps one of my favourite features of switching over to Dockview.

Out of curiosity, anything on the roadmap to pull a tab out into a totally new browser window?

@mathuo
Copy link
Owner

mathuo commented Oct 6, 2023

Released in version 1.8.4

@mathuo mathuo closed this as completed Oct 6, 2023
@garyvh2
Copy link

garyvh2 commented Dec 14, 2023

Hey there @mathuo I've ran into an instance of this issue when applying display: none on the element containing the view.

Here's a video, not sure if you have any recommendations.

Screen.Recording.2023-12-14.at.15.23.54.mov

@fwhatley
Copy link

Any answer on @garyvh2 comment? I am seeing the same issue where when you use display:none, the library resets the floating windows position to 0,0.

@mathuo
Copy link
Owner

mathuo commented Jan 17, 2024

Any answer on @garyvh2 comment? I am seeing the same issue where when you use display:none, the library resets the floating windows position to 0,0.

Hey. - can you expand on what exactly you are doing please. Slightly unsure where the display: none is coming from?

@garyvh2
Copy link

garyvh2 commented Jan 17, 2024

In my case at least, we have a top level utility that works as a tab manager, each tab has an instance of Dockview, when the tab is not selected, the content gets applied display: none causing Dockview to recalculate its size over a non rendered view.

@mathuo
Copy link
Owner

mathuo commented Jan 17, 2024

In my case at least, we have a top level utility that works as a tab manager, each tab has an instance of Dockview, when the tab is not selected, the content gets applied display: none causing Dockview to recalculate its size over a non rendered view.

ah ok - so in your case you are setting a display: none on the entire dockview instance?

@garyvh2
Copy link

garyvh2 commented Jan 17, 2024

I think is on a div on top of it, but yeah, not sure if there's a workaround to make sure size is preserved when display none is applied.

@mathuo
Copy link
Owner

mathuo commented Jan 17, 2024

I think is on a div on top of it, but yeah, not sure if there's a workaround to make sure size is preserved when display none is applied.

nice, that makes more sense. I have a feeling it's probably something in the resizable.ts logic. I will need to check how this behaves with display: none, will open as a new issue. Thanks

@garyvh2
Copy link

garyvh2 commented Jan 17, 2024

Much appreciated, Mathuo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants