Comment by garbagepatch

10 months ago

Does this use the new moveBefore API to move DOM elements while preserving their state? Or is it going to recreate the elements eitherway due to React/Vue?

I'd be surprised if it uses moveBefore for something that seems to have put so much thought into being portable. moveBefore doesn't even have an entry in MDN yet, the only references I can find to it suggest it's still only available behind a flag in Chrome canary.

  • It could support it as a progressive enhancement.

    • I personally wouldn't even bother with that yet.

      Once it's available in even one browser not behind a flag, sure, but while it's still entirely undocumented and only available to people who both use Chrome Canary and know to go turn on a specific flag?

There are multiple ways in which you can specify how the panel renders.

https://dockview.dev/docs/core/panels/rendering

Options exist for multiple cases:

1. Where you never want the elements DOM position to move (`always` rendering mode) and the HTMLElement is simply hidden (display: none) when not visible. 2. Where you only want the DOM element to exist when the panel is visible (`onlyWhenVisible` mode)

In the case of React the React Tree is always maintained in either mode.