@brightspace-ui/core 3.243.1 → 3.243.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -844,15 +844,15 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(LitElement))
844
844
  let selectedTab = null;
845
845
  const newTabIds = {};
846
846
  this._tabs?.forEach((tab) => {
847
- if (this._initialized && !reduceMotion && this._tabs.length !== Object.keys(this._tabIds).length) {
847
+ const isNew = this._initialized && !this._tabIds[tab.id];
848
+ if (isNew && !reduceMotion && this._tabs.length !== Object.keys(this._tabIds).length) {
848
849
  // if it's a new tab, update state to animate addition
849
- if (!this._tabIds[tab.id]) {
850
- this._tabIds[tab.id] = true;
851
- tab.setAttribute('data-state', 'adding');
852
- }
850
+ this._tabIds[tab.id] = true;
851
+ tab.setAttribute('data-state', 'adding');
853
852
  }
854
- if (!selectedTab && tab.selected && tab.getAttribute('data-state') !== 'removing') {
855
- selectedTab = tab;
853
+ if (tab.selected && tab.getAttribute('data-state') !== 'removing') {
854
+ // Newly added tabs with selected=true take priority over existing selected tabs
855
+ if (!selectedTab || isNew) selectedTab = tab;
856
856
  }
857
857
  newTabIds[tab.id] = true;
858
858
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.243.1",
3
+ "version": "3.243.2",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",