@brightspace-ui/core 2.86.1 → 2.86.3

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.
@@ -349,7 +349,10 @@ Collapsible panels have two optional slots, `header` and `actions` that can be u
349
349
  </div>
350
350
  <d2l-collapsible-panel-summary-item slot="summary" text="Week 2 Lab (PDF) attached"></d2l-collapsible-panel-summary-item>
351
351
  <d2l-collapsible-panel-summary-item slot="summary" text="1 comment"></d2l-collapsible-panel-summary-item>
352
- Expanded content
352
+ <p style="margin-top: 0;">Sweet roll candy dessert caramels shortbread gummies toffee oat cake cookie. Wafer gummies shortbread sweet halvah jujubes sweet. Cake chocolate chocolate bar carrot cake marzipan. Icing chupa chups jujubes macaroon toffee chocolate bar wafer croissant.</p>
353
+ <p>Toffee pastry chupa chups lollipop carrot cake chocolate cake sweet roll sweet roll. Marzipan pudding candy canes jelly lemon drops oat cake ice cream. Wafer danish pudding marzipan chupa chups jelly beans brownie.</p>
354
+ <p>Pastry apple pie biscuit sesame snaps sweet pie apple pie dessert jelly beans. Lemon drops croissant tootsie roll croissant oat cake. Macaroon toffee pie gummi bears cupcake wafer tiramisu.</p>
355
+ <p style="margin-bottom: 0;">Chocolate cake ice cream cake chocolate bar dessert. Donut tiramisu fruitcake tiramisu liquorice shortbread sugar plum macaroon caramels. Tart candy cookie ice cream dessert tootsie roll.</p>
353
356
  </d2l-collapsible-panel>
354
357
  ```
355
358
 
@@ -103,15 +103,16 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
103
103
  :host(:not([expanded])) .d2l-collapsible-panel {
104
104
  cursor: pointer;
105
105
  }
106
- :host([type=subtle]) .d2l-collapsible-panel {
106
+ :host([type="subtle"]) .d2l-collapsible-panel {
107
107
  background-color: white;
108
108
  border: none;
109
109
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.03);
110
110
  }
111
- :host([type=inline]) .d2l-collapsible-panel {
111
+ :host([type="inline"]) .d2l-collapsible-panel {
112
112
  border-left: none;
113
113
  border-radius: 0;
114
114
  border-right: none;
115
+ outline-offset: -2px;
115
116
  }
116
117
  :host([heading-style="1"]) {
117
118
  --d2l-collapsible-panel-header-spacing: 1.2rem;
@@ -124,6 +125,10 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
124
125
  cursor: pointer;
125
126
  padding: var(--d2l-collapsible-panel-header-spacing) 0;
126
127
  }
128
+ :host([type="inline"]) .d2l-collapsible-panel-header {
129
+ border-radius: 0;
130
+ outline-offset: -2px;
131
+ }
127
132
  .d2l-collapsible-panel.scrolled .d2l-collapsible-panel-header {
128
133
  background-color: white;
129
134
  box-shadow: 0 8px 12px -9px rgba(0, 0, 0, 0.3);
@@ -257,16 +257,28 @@ document.querySelector('#open').addEventListener('click', () => {
257
257
  });
258
258
  ```
259
259
 
260
- ## Focus Management
260
+ ## Accessibility
261
+
262
+ ### Focus Management
261
263
 
262
264
  When opened, focus will be automatically placed within the dialog. The element to be focused will either be the content element having the optional `autofocus` attribute, or a focusable element identified by the dialog depending on the type of dialog. For `d2l-dialog` and `d2l-dialog-fullscreen`, the first focusable element will be focused. For `d2l-dialog-confirm`, the least destructive action will be focused, which is assumed to be the first non-primary button in the footer.
263
265
 
264
- ### Specifying an `autofocus` Element (Optional)
266
+ #### Specifying an `autofocus` Element (Optional)
265
267
 
266
268
  To specify which element should be focused, add the `autofocus` attribute to that element. An element with the `autofocus` attribute will receive focus if the element has a `tabindex` value of `0` or `-1`, or is a naturally focusable element (e.g. button).
267
269
 
268
270
  Note that the element must be in the dialog content's DOM scope and not within another component's Shadow DOM.
269
271
 
272
+ ### Announcing the dialog text
273
+
274
+ When using `d2l-dialog` or `d2l-dialog-fullscreen` the dialog text will not be announced by screen readers. Screen readers will announce the presence of a dialog, the dialog title, and the currently focused element. For example, the general dialog example at the top of this page reads "Dialog Title dialog. clickable Done button.". The text "Some dialog content" is not announced.
275
+
276
+ To announce the dialog text, use one of the following methods:
277
+
278
+ 1. Use `d2l-dialog-confirm` instead
279
+ 2. Add `describe-content="true"` (if using `d2l-dialog`)
280
+ 3. Set `autofocus` on the first text element (see above for details)
281
+
270
282
  <!-- docs: start hidden content -->
271
283
  ## Future Improvements
272
284
 
@@ -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.1",
3
+ "version": "2.86.3",
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",