@brightspace-ui/core 2.86.1 → 2.86.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.
- package/components/tooltip/tooltip.js +11 -12
- package/package.json +1 -1
|
@@ -11,6 +11,9 @@ import { styleMap } from 'lit/directives/style-map.js';
|
|
|
11
11
|
|
|
12
12
|
let logAccessibilityWarning = true;
|
|
13
13
|
|
|
14
|
+
/* only one tooltip is to be shown at once - track the active tooltip so it can be hidden if necessary */
|
|
15
|
+
let activeTooltip = null;
|
|
16
|
+
|
|
14
17
|
const pointerLength = 16;
|
|
15
18
|
const pointerOverhang = 7; /* how far the pointer extends outside the content */
|
|
16
19
|
|
|
@@ -430,8 +433,6 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
430
433
|
this._onTargetTouchStart = this._onTargetTouchStart.bind(this);
|
|
431
434
|
this._onTargetTouchEnd = this._onTargetTouchEnd.bind(this);
|
|
432
435
|
|
|
433
|
-
this._onTooltipShowOther = this._onTooltipShowOther.bind(this);
|
|
434
|
-
|
|
435
436
|
this.announced = false;
|
|
436
437
|
this.closeOnClick = false;
|
|
437
438
|
this.delay = 300;
|
|
@@ -474,9 +475,9 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
474
475
|
|
|
475
476
|
disconnectedCallback() {
|
|
476
477
|
super.disconnectedCallback();
|
|
478
|
+
if (activeTooltip === this) activeTooltip = null;
|
|
477
479
|
this._removeListeners();
|
|
478
480
|
window.removeEventListener('resize', this._onTargetResize);
|
|
479
|
-
document.body.removeEventListener('d2l-tooltip-show', this._onTooltipShowOther);
|
|
480
481
|
clearDismissible(this._dismissibleId);
|
|
481
482
|
delayTimeoutId = null;
|
|
482
483
|
this._dismissibleId = null;
|
|
@@ -862,11 +863,6 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
862
863
|
}, 500);
|
|
863
864
|
}
|
|
864
865
|
|
|
865
|
-
_onTooltipShowOther() {
|
|
866
|
-
// only allow one tooltip showing at a time
|
|
867
|
-
this.hide();
|
|
868
|
-
}
|
|
869
|
-
|
|
870
866
|
_removeListeners() {
|
|
871
867
|
if (!this._target) {
|
|
872
868
|
return;
|
|
@@ -890,6 +886,11 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
890
886
|
clearTimeout(this._hoverTimeout);
|
|
891
887
|
clearTimeout(this._longPressTimeout);
|
|
892
888
|
if (newValue) {
|
|
889
|
+
if (!this.forceShow) {
|
|
890
|
+
if (activeTooltip) activeTooltip.hide();
|
|
891
|
+
activeTooltip = this;
|
|
892
|
+
}
|
|
893
|
+
|
|
893
894
|
this._dismissibleId = setDismissible(() => this.hide());
|
|
894
895
|
this.setAttribute('aria-hidden', 'false');
|
|
895
896
|
await this.updateComplete;
|
|
@@ -898,10 +899,10 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
898
899
|
'd2l-tooltip-show', { bubbles: true, composed: true }
|
|
899
900
|
));
|
|
900
901
|
|
|
901
|
-
document.body.addEventListener('d2l-tooltip-show', this._onTooltipShowOther, true);
|
|
902
|
-
|
|
903
902
|
if (this.announced && !this._isInteractive(this._target)) announce(this.innerText);
|
|
904
903
|
} else {
|
|
904
|
+
if (activeTooltip === this) activeTooltip = null;
|
|
905
|
+
|
|
905
906
|
this.setAttribute('aria-hidden', 'true');
|
|
906
907
|
if (this._dismissibleId) {
|
|
907
908
|
clearDismissible(this._dismissibleId);
|
|
@@ -910,8 +911,6 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
910
911
|
this.dispatchEvent(new CustomEvent(
|
|
911
912
|
'd2l-tooltip-hide', { bubbles: true, composed: true }
|
|
912
913
|
));
|
|
913
|
-
|
|
914
|
-
document.body.removeEventListener('d2l-tooltip-show', this._onTooltipShowOther, true);
|
|
915
914
|
}
|
|
916
915
|
}
|
|
917
916
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.86.
|
|
3
|
+
"version": "2.86.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",
|