JSFiddle - React, Tailwind, and code Playground

HTML

<div id="bk-scaffold">
    
    <ul id="pui-tabs">
        <li id="tab-0">
            <a href="#tabs-0">
                <span class="pui-name">Tab 1</span>
            </a><span class="pui-close">(X)</span>
        </li>
        <li id="tab-1">
            <a href="#tabs-1">
                <span class="pui-name">Tab 2</span>
            </a><span class="pui-close">(X)</span>
        </li>
        <li id="tab-2">
            <a href="#tabs-2">
                <span class="pui-name">Tab 3</span>
            </a><span class="pui-close">(X)</span>
        </li>
    </ul>
    
    <div id="tabs-0">
        <ul id="bk-tabs-0" class="connectedSortable pui-marks" style="min-height:177px;">
            <li id="br_0" class="pui-bk-item">
                Tab 1 Content 1
            </li>
        </ul>
    </div>
    
    <div id="tabs-1">
        <ul id="bk-tabs-1" class="connectedSortable pui-marks" style="min-height:177px;">
            <li id="br_1" class="pui-bk-item">
                Tab 2 Content 1
            </li>
            <li id="br_2" class="pui-bk-item">
                Tab 2 Content 2
            </li>
        </ul>
    </div>
    
    <div id="tabs-2">
        <ul id="bk-tabs-2" class="connectedSortable pui-marks" style="min-height:177px;">
            <li id="br_3" class="pui-bk-item">
                Tab 3 Content 1
            </li>
            <li id="br_4" class="pui-bk-item">
                Tab 3 Content 2
            </li>
            <li id="br_5" class="pui-bk-item">
                Tab 3 Content 3
            </li>
        </ul>
    </div>
    
</div>

CSS

/*
* jQuery UI CSS Framework @VERSION
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/

/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }


/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }


/* Icons
----------------------------------*/

/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }


/* Misc visuals
----------------------------------*/

/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }


/*
* jQuery UI CSS Framework @VERSION
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/
*/


/* Component containers
----------------------------------*/
.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget...

JavaScript

//***************************************
// SCENARIO: WRONG TAB REMOVED
// **************************************
// EXAMPLE:
// STEP 1: CLICK AND DRAG Tab 3 TO MIDDLE (PLACE BETWEEN Tab 1 & Tab 2)
// STEP 2: REMOVE Tab 1 BY CLICKING THE "(X)"
// STEP 3: CLICK Tab 3 & REMOVE IT
// STEP 4: CLICK Tab 2 & REMOVE IT


// RESULT: VOILA! WORKS CORRECTLY

// TABS SETUP
$(document).ready(function() {
    var $tabs = $('#bk-scaffold').tabs();
    $tabs.find('.ui-tabs-nav').sortable({
        // FIXED WITH THE FOLLOWING UPDATE
        update: function() {
            var container = $(this); // ul
            var panel;
            $(this).children().each(function() {
                panel = $($(this).find('a').attr('href'));
                panel.insertAfter(container);
                container = panel; // div
            });
        }
    });
    
    $('#pui-tabs .pui-close').live('click', function(e) {
       e.stopImmediatePropagation();           
       $tabs.tabs('remove', $tabs.tabs('option', 'selected'));
    });
});