formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

[Builder] Tab will jump to first tab when component already on the form is dropped in

Open ShermanE1 opened this issue 2 years ago • 4 comments

Environment

  • Hosting type: https://formio.github.io/formio.js/app/builder
  • Browser: Chrome
  • Version: 115.0.5790.110

Steps to Reproduce

  1. Add any Basic component to a form
  2. Add a Tabs component with two tabs to the same form
  3. Select the second tab
  4. Drag & drop the component that was added in the first step to the second tab

Expected behavior

Tabs component should still be in the second tab

Observed behavior

Tabs component will switch to display the first tab

Example

screen-capture.webm

Note: A similar issue seems to have been fixed a while so that when dragging a new component from the side panel into a tab it renders the correct tab (#1689); however, the issue is still present when dragging a component that is already on the form into a tab.

ShermanE1 avatar Aug 14 '23 00:08 ShermanE1

I just tried this out with the latest version of our renderer and it seems to be working for me. When I drag a component into the second tab it stays on the second tab. Can you provide a jsfiddle of this not working for you?

travist avatar Aug 31 '23 13:08 travist

Yes, this does appear to be fixed in the latest version. Thank you!

ShermanE1 avatar Aug 31 '23 23:08 ShermanE1

After updating to the latest version, it seems that this error still exists. If you navigate to Tab 2 in this jfiddle and drag the Last Name field into it, the tab component will switch to the first tab.

This only happens when dragging components that are already on the form into the second tab. If you drag a new component into the second tab, it will stay on the correct tab.

mk160107 avatar Sep 08 '23 17:09 mk160107

Very interesting, and thank you for providing a JSFiddle!!! That is super helpful. This is most likely due to the difference of "addComponent" and "moveComponent" within the form builder. Definitely a bug, but is very minor and may have a hard time getting prioritized. If you submit a pull request, then we will be happy to include this in our next build.

travist avatar Sep 28 '23 12:09 travist