@brightspace-ui/core 3.164.5 → 3.164.6

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.
@@ -482,6 +482,9 @@
482
482
  document.addEventListener('d2l-tab-panel-selected', (e) => {
483
483
  console.log('tab panel selected', e);
484
484
  });
485
+ document.addEventListener('d2l-tab-selected', (e) => {
486
+ console.log('tab selected', e);
487
+ });
485
488
  document.addEventListener('d2l-tab-panel-text-changed', (e) => {
486
489
  console.log('tab panel text changed', e);
487
490
  });
@@ -1,5 +1,6 @@
1
1
  import '../colors/colors.js';
2
2
  import { css, html } from 'lit';
3
+ import { getFlag } from '../../helpers/flags.js';
3
4
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
4
5
 
5
6
  const keyCodes = {
@@ -94,6 +95,7 @@ export const TabMixin = superclass => class extends SkeletonMixin(superclass) {
94
95
  this.tabIndex = -1;
95
96
 
96
97
  this._clicked = false;
98
+ this._noInitialSelectedEvent = getFlag('GAUD-8605-tab-no-initial-selected-event', false);
97
99
  }
98
100
 
99
101
  firstUpdated(changedProperties) {
@@ -102,6 +104,8 @@ export const TabMixin = superclass => class extends SkeletonMixin(superclass) {
102
104
  this.addEventListener('click', this.#handleClick);
103
105
  this.addEventListener('keydown', this.#handleKeydown);
104
106
  this.addEventListener('keyup', this.#handleKeyup);
107
+
108
+ this.#hasInitialized = true;
105
109
  }
106
110
 
107
111
  render() {
@@ -116,6 +120,8 @@ export const TabMixin = superclass => class extends SkeletonMixin(superclass) {
116
120
 
117
121
  if (changedProperties.has('selected')) {
118
122
  this.ariaSelected = `${this.selected}`;
123
+ if (!this.#hasInitialized && this._noInitialSelectedEvent) return; // Only fire events if selected changes after initial render
124
+
119
125
  if (this.selected) {
120
126
  /** Dispatched when a tab is selected */
121
127
  this.dispatchEvent(new CustomEvent(
@@ -145,6 +151,8 @@ export const TabMixin = superclass => class extends SkeletonMixin(superclass) {
145
151
  return html`<div>Default Tab Content</div>`;
146
152
  }
147
153
 
154
+ #hasInitialized = false;
155
+
148
156
  #handleClick() {
149
157
  if (this.selected) return;
150
158
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.164.5",
3
+ "version": "3.164.6",
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",