@brightspace-ui/core 3.123.0 → 3.123.1
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.
@@ -7,6 +7,7 @@ import { classMap } from 'lit/directives/class-map.js';
|
|
7
7
|
import { EventSubscriberController } from '../../controllers/subscriber/subscriberControllers.js';
|
8
8
|
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
9
9
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
10
|
+
import { isComposedAncestor } from '../../helpers/dom.js';
|
10
11
|
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
11
12
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
12
13
|
|
@@ -84,6 +85,7 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
84
85
|
* @type {boolean}
|
85
86
|
*/
|
86
87
|
noSticky: { attribute: 'no-sticky', type: Boolean },
|
88
|
+
_clicked: { state: true },
|
87
89
|
_focused: { state: true },
|
88
90
|
_hasBefore: { state: true },
|
89
91
|
_hasSummary: { state: true },
|
@@ -321,6 +323,7 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
321
323
|
this.paddingType = 'default';
|
322
324
|
this.type = 'default';
|
323
325
|
this.noSticky = false;
|
326
|
+
this._clicked = false;
|
324
327
|
this._focused = false;
|
325
328
|
this._group = undefined;
|
326
329
|
this._groupSubscription = new EventSubscriberController(this, 'collapsible-panel-group', {
|
@@ -346,7 +349,7 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
346
349
|
render() {
|
347
350
|
const classes = {
|
348
351
|
'd2l-collapsible-panel': true,
|
349
|
-
'focused': this._focused,
|
352
|
+
'focused': this._focused && !this._clicked,
|
350
353
|
'has-summary': this._hasSummary,
|
351
354
|
'has-before': this._hasBefore,
|
352
355
|
'scrolled': this._scrolled,
|
@@ -414,13 +417,6 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
414
417
|
));
|
415
418
|
}
|
416
419
|
|
417
|
-
_handleHeaderClick(e) {
|
418
|
-
if (this.expanded) {
|
419
|
-
this._toggleExpand();
|
420
|
-
e.stopPropagation();
|
421
|
-
}
|
422
|
-
}
|
423
|
-
|
424
420
|
_handleHeaderSecondaryClick(e) {
|
425
421
|
const header = this.shadowRoot.querySelector('.d2l-collapsible-panel-header-secondary');
|
426
422
|
if (e.target !== header) {
|
@@ -429,10 +425,9 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
429
425
|
}
|
430
426
|
|
431
427
|
_handlePanelClick(e) {
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
}
|
428
|
+
this._clicked = e.detail && e.detail > 0; // detect if click event is from a mouse
|
429
|
+
const content = this.shadowRoot.querySelector('.d2l-collapsible-panel-content');
|
430
|
+
if (e.target !== content && !isComposedAncestor(content, e.target)) this._toggleExpand();
|
436
431
|
}
|
437
432
|
|
438
433
|
_handleSummarySlotChange(e) {
|
@@ -442,6 +437,7 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
442
437
|
|
443
438
|
_onBlur() {
|
444
439
|
this._focused = false;
|
440
|
+
this._clicked = false;
|
445
441
|
}
|
446
442
|
|
447
443
|
_onFocus() {
|
@@ -450,7 +446,7 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
450
446
|
|
451
447
|
_renderHeader() {
|
452
448
|
return html`
|
453
|
-
<div class="d2l-collapsible-panel-header"
|
449
|
+
<div class="d2l-collapsible-panel-header">
|
454
450
|
<div class="d2l-collapsible-panel-before">
|
455
451
|
<slot name="before" @slotchange="${this._handleBeforeSlotChange}"></slot>
|
456
452
|
</div>
|
@@ -488,7 +484,6 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
|
|
488
484
|
class="d2l-collapsible-panel-opener"
|
489
485
|
aria-expanded="${this.expanded}"
|
490
486
|
type="button"
|
491
|
-
@click="${this._handleHeaderClick}"
|
492
487
|
@focus="${this._onFocus}"
|
493
488
|
@blur="${this._onBlur}"
|
494
489
|
aria-label="${ifDefined(this.expandCollapseLabel)}">${this.panelTitle}</button>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.123.
|
3
|
+
"version": "3.123.1",
|
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",
|