@brightspace-ui/core 3.151.3 → 3.151.5

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.
@@ -114,7 +114,8 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
114
114
  this.addEventListener('d2l-dropdown-open', this.__onOpened);
115
115
  this.addEventListener('d2l-dropdown-close', this.__onClosed);
116
116
  const content = this.__getContentElement();
117
- this._setOpenerElementAttribute(content?.opened || false);
117
+ const contentRole = content?.tagName === 'D2L-DROPDOWN-MENU' ? 'menu' : 'true';
118
+ this._setOpenerElementAttribute(content?.opened || false, false, contentRole);
118
119
  }
119
120
 
120
121
  updated(changedProperties) {
@@ -190,7 +191,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
190
191
  __getContentElement() {
191
192
  if (!this.shadowRoot) return undefined;
192
193
  return this.shadowRoot.querySelector('slot:not([name])').assignedNodes()
193
- .filter(node => node.hasAttribute && node.hasAttribute('dropdown-content'))[0];
194
+ .filter(node => node.hasAttribute && (node._dropdownContent || node.hasAttribute('dropdown-content')))[0];
194
195
  }
195
196
 
196
197
  __onClosed() {
@@ -331,11 +332,12 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
331
332
  }
332
333
  }
333
334
 
334
- _setOpenerElementAttribute(val, setActive = false) {
335
+ _setOpenerElementAttribute(val, setActive = false, hasPopup) {
335
336
  const opener = this.getOpenerElement();
336
337
  if (!opener) return false;
337
338
  const attribute = opener.isButtonMixin ? 'expanded' : 'aria-expanded';
338
339
  opener.setAttribute(attribute, val.toString());
340
+ if (hasPopup) opener.setAttribute('aria-haspopup', hasPopup);
339
341
  if (setActive) {
340
342
  if (val) opener.setAttribute('active', 'true');
341
343
  else opener.removeAttribute('active');
@@ -1,5 +1,8 @@
1
1
 
2
2
  import '../../button/button.js';
3
+ import '../../button/button-icon.js';
4
+ import '../../button/button-subtle.js';
5
+ import '../../selection/selection-action.js';
3
6
  import '../overflow-group.js';
4
7
  import { html, LitElement } from 'lit';
5
8
  import { LocalizeCoreElement } from '../../../helpers/localize-core-element.js';
@@ -15,7 +18,10 @@ class DemoOverflowGroup extends LocalizeCoreElement(LitElement) {
15
18
  <d2l-button>${this.localize('components.more-less.more')}</d2l-button>
16
19
  <d2l-button>${this.localize('components.more-less.less')}</d2l-button>
17
20
  <d2l-button> ${this.localize('components.more-less.more')}</d2l-button>
18
- <d2l-button> ${this.localize('components.more-less.less')}</d2l-button>
21
+ <button>${this.localize('components.more-less.less')}</button>
22
+ <d2l-button-icon icon="tier1:gear" text="${this.localize('components.more-less.more')}"></d2l-button-icon>
23
+ <d2l-button-subtle text="${this.localize('components.more-less.less')}"></d2l-button-subtle>
24
+ <d2l-selection-action icon="tier1:bookmark-hollow" text="${this.localize('components.more-less.more')}"></d2l-selection-action>
19
25
  </d2l-overflow-group>
20
26
  `;
21
27
  }
@@ -20,7 +20,18 @@ const OPENER_STYLE = {
20
20
  };
21
21
 
22
22
  function createMenuItem(node) {
23
- const childText = node.text || node.firstChild && (node.firstChild.label || node.firstChild.text || node.firstChild.textContent.trim());
23
+ let childText = node.text;
24
+ if (!childText) {
25
+ const childNode = Array.from(node.childNodes).find(childNode => {
26
+ if (childNode.nodeType === Node.COMMENT_NODE) return false;
27
+ if (childNode.nodeType === Node.TEXT_NODE && !childNode.textContent.trim()) return false;
28
+ return true;
29
+ });
30
+ if (childNode) {
31
+ childText = childNode.label || childNode.text || childNode.textContent.trim();
32
+ }
33
+ }
34
+
24
35
  const disabled = !!node.disabled;
25
36
  const handleItemSelect = () => {
26
37
  node.dispatchEvent(new CustomEvent('d2l-button-ghost-click'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.151.3",
3
+ "version": "3.151.5",
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",