@brightspace-ui/core 3.237.5 → 3.237.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.
@@ -10,6 +10,8 @@ import { isPopoverSupported } from '../popover/popover-mixin.js';
10
10
  import { PageableMixin } from '../paging/pageable-mixin.js';
11
11
  import { SelectionMixin } from '../selection/selection-mixin.js';
12
12
 
13
+ const enableStickyScrollyFix = getFlag('table-sticky-scrolly-fix', true);
14
+
13
15
  export const tableStyles = css`
14
16
  .d2l-table {
15
17
  border-collapse: separate; /* needed to override reset stylesheets */
@@ -447,6 +449,10 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
447
449
  }
448
450
  }
449
451
 
452
+ #hasIntersected = false;
453
+
454
+ #noScrollWidthTimeout = null;
455
+
450
456
  _applyClassNames() {
451
457
  if (!this._table) return;
452
458
 
@@ -581,6 +587,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
581
587
  this._tableIntersectionObserver = new IntersectionObserver((entries) => {
582
588
  entries.forEach((entry) => {
583
589
  if (entry.isIntersecting) {
590
+ this.#hasIntersected = true;
584
591
  this._handleTableChange();
585
592
  }
586
593
  });
@@ -647,11 +654,20 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
647
654
  const head = this._table.querySelector('thead');
648
655
  const body = this._table.querySelector('tbody');
649
656
 
650
- const maxScrollWidth = Math.max(head?.scrollWidth, body?.scrollWidth);
651
- setTimeout(() => {
652
- this._noScrollWidth = this.clientWidth === maxScrollWidth;
653
- });
654
- if (!head || !body || !this._table || !this.stickyHeaders || !this.stickyHeadersScrollWrapper || this._noScrollWidth) return;
657
+ if (enableStickyScrollyFix) {
658
+ clearTimeout(this.#noScrollWidthTimeout);
659
+ this.#noScrollWidthTimeout = setTimeout(() => {
660
+ const maxScrollWidth = Math.max(head?.scrollWidth, body?.scrollWidth);
661
+ this._noScrollWidth = (maxScrollWidth <= this.clientWidth);
662
+ });
663
+ if (!head || !body || !this.stickyHeaders || !this.stickyHeadersScrollWrapper || this._noScrollWidth || !this.#hasIntersected) return;
664
+ } else {
665
+ const maxScrollWidth = Math.max(head?.scrollWidth, body?.scrollWidth);
666
+ setTimeout(() => {
667
+ this._noScrollWidth = this.clientWidth === maxScrollWidth;
668
+ });
669
+ if (!head || !body || !this._table || !this.stickyHeaders || !this.stickyHeadersScrollWrapper || this._noScrollWidth) return;
670
+ }
655
671
 
656
672
  const candidateRowHeadCells = [];
657
673
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.237.5",
3
+ "version": "3.237.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",