@brightspace-ui/core 1.224.2 → 1.226.0

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.
@@ -1,6 +1,6 @@
1
1
  # Colors
2
2
 
3
- Importing `colors` will add the color palette [CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*) to the document and polyfill for IE11 using [shadyCSS](https://github.com/webcomponents/shadycss).
3
+ Importing `colors` will add the color palette [CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*) to the document.
4
4
 
5
5
  Run the demo page to see the full palette. See [colors.js](colors.js) for the variable names (i.e. `--d2l-color-*`).
6
6
 
@@ -26,4 +26,4 @@ Run the demo page to see the full palette. See [colors.js](colors.js) for the va
26
26
 
27
27
  ## Future Enhancements
28
28
 
29
- Looking for an enhancement not listed here? Create a GitHub issue!
29
+ Looking for an enhancement not listed here? Create a GitHub issue!
@@ -83,6 +83,12 @@ The `d2l-dialog` element is a generic dialog that provides a slot for arbitrary
83
83
  - `d2l-dialog-close`: dispatched with the action value when the dialog is closed for any reason
84
84
  <!-- docs: end hidden content -->
85
85
 
86
+ ### Accessibility Properties
87
+
88
+ | Attribute | Description |
89
+ |--|--|
90
+ | `describe-content` | When set, screen readers will announce the contents when opened. |
91
+
86
92
  ### Methods
87
93
 
88
94
  - `resize`: resizes the dialog based on specified `width` and measured content height
@@ -10,7 +10,7 @@ import { getUniqueId } from '../../helpers/uniqueId.js';
10
10
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
11
11
  import { styleMap } from 'lit-html/directives/style-map.js';
12
12
 
13
- const mediaQueryList = window.matchMedia('(max-width: 615px)');
13
+ const mediaQueryList = window.matchMedia('(max-width: 615px), (max-height: 420px) and (max-width: 900px)');
14
14
 
15
15
  /**
16
16
  * A generic fullscreen dialog that provides a slot for arbitrary content and a "footer" slot for workflow buttons. Apply the "data-dialog-action" attribute to workflow buttons to automatically close the dialog with the action value.
@@ -132,7 +132,7 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
132
132
  }
133
133
  }
134
134
 
135
- @media (max-width: 615px) {
135
+ @media (max-width: 615px), (max-height: 420px) and (max-width: 900px) {
136
136
 
137
137
  .d2l-dialog-header {
138
138
  padding-bottom: 15px;
@@ -8,6 +8,7 @@ import { DialogMixin } from './dialog-mixin.js';
8
8
  import { dialogStyles } from './dialog-styles.js';
9
9
  import { getUniqueId } from '../../helpers/uniqueId.js';
10
10
  import { heading3Styles } from '../typography/styles.js';
11
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
11
12
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
12
13
  import { styleMap } from 'lit-html/directives/style-map.js';
13
14
 
@@ -27,6 +28,11 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
27
28
  */
28
29
  async: { type: Boolean },
29
30
 
31
+ /**
32
+ * Whether to read the contents of the dialog on open
33
+ */
34
+ describeContent: { type: Boolean, attribute: 'describe-content' },
35
+
30
36
  /**
31
37
  * The preferred width (unit-less) for the dialog
32
38
  */
@@ -100,6 +106,7 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
100
106
  constructor() {
101
107
  super();
102
108
  this.async = false;
109
+ this.describeContent = false;
103
110
  this.width = 600;
104
111
  this._handleResize = this._handleResize.bind(this);
105
112
  this._handleResize();
@@ -151,9 +158,10 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
151
158
  'd2l-footer-no-content': !this._hasFooterContent
152
159
  };
153
160
 
161
+ if (!this._textId && this.describeContent) this._textId = getUniqueId();
154
162
  const content = html`
155
163
  ${loading}
156
- <div style=${styleMap(slotStyles)}><slot></slot></div>
164
+ <div id="${ifDefined(this._textId)}" style=${styleMap(slotStyles)}><slot></slot></div>
157
165
  `;
158
166
 
159
167
  if (!this._titleId) this._titleId = getUniqueId();
@@ -171,9 +179,11 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
171
179
  </div>
172
180
  </div>
173
181
  `;
182
+
183
+ const descId = (this.describeContent) ? this._textId : undefined;
174
184
  return this._render(
175
185
  inner,
176
- { labelId: this._titleId, role: 'dialog' },
186
+ { labelId: this._titleId, descId: descId, role: 'dialog' },
177
187
  topOverride
178
188
  );
179
189
  }
@@ -110,11 +110,12 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
110
110
  updated(changedProperties) {
111
111
  super.updated(changedProperties);
112
112
  if (!this.openOnHover || !changedProperties.has('_isFading')) return;
113
-
113
+ const element = this.__getContentElement();
114
+ if (!element) return;
114
115
  if (this._isFading) {
115
- this.__getContentElement()?.classList.add('d2l-dropdown-content-fading');
116
+ element.classList.add('d2l-dropdown-content-fading');
116
117
  } else {
117
- this.__getContentElement()?.classList.remove('d2l-dropdown-content-fading');
118
+ element.classList.remove('d2l-dropdown-content-fading');
118
119
  }
119
120
  }
120
121
 
@@ -254,7 +255,9 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
254
255
  if (this.noAutoOpen) return;
255
256
  if (this.openOnHover) {
256
257
  // prevent propogation to window and triggering _onOutsideClick
257
- e?.stopPropagation();
258
+ if (e) {
259
+ e.stopPropagation();
260
+ }
258
261
  this._closeTimerStop();
259
262
  if (this._isOpen && !this._isHovering) {
260
263
  this.closeDropdown();
@@ -1599,6 +1599,12 @@
1599
1599
  "type": "boolean",
1600
1600
  "default": "false"
1601
1601
  },
1602
+ {
1603
+ "name": "describe-content",
1604
+ "description": "Whether to read the contents of the dialog on open",
1605
+ "type": "boolean",
1606
+ "default": "false"
1607
+ },
1602
1608
  {
1603
1609
  "name": "width",
1604
1610
  "description": "The preferred width (unit-less) for the dialog",
@@ -1625,6 +1631,13 @@
1625
1631
  "type": "boolean",
1626
1632
  "default": "false"
1627
1633
  },
1634
+ {
1635
+ "name": "describeContent",
1636
+ "attribute": "describe-content",
1637
+ "description": "Whether to read the contents of the dialog on open",
1638
+ "type": "boolean",
1639
+ "default": "false"
1640
+ },
1628
1641
  {
1629
1642
  "name": "width",
1630
1643
  "attribute": "width",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.224.2",
3
+ "version": "1.226.0",
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",