desy-html 17.0.0 → 17.0.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.
@@ -1,90 +1,177 @@
1
1
  {% from "components/combobox/_macro.combobox.njk" import componentCombobox %}
2
2
 
3
- <div class="grid lg:grid-cols-4 gap-xl mb-lg items-end">
3
+ <div class="grid lg:grid-cols-5 gap-xl mb-lg items-end">
4
4
  <div>
5
5
  {{ componentCombobox({
6
- "id": "ds-combobox-default",
7
- "name": "ds-combobox-default",
8
- "label": {
9
- "text": "Provincia"
10
- },
11
- "items": [
12
- {
13
- "text": "Huesca"
14
- },
15
- {
16
- "text": "Zaragoza"
17
- },
18
- {
19
- "text": "Teruel"
20
- }
6
+ id: "ds-combobox-default",
7
+ name: "ds-combobox-default",
8
+ label: { text: "Esto es un label" },
9
+ items: [
10
+ { text: "Huesca" },
11
+ { text: "Zaragoza" },
12
+ { text: "Teruel" }
21
13
  ]
22
14
  }) }}
23
15
  </div>
24
16
  <div>
25
17
  {{ componentCombobox({
26
- "id": "ds-combobox-disabled",
27
- "name": "ds-combobox-disabled",
28
- "label": {
29
- "text": "Provincia"
30
- },
31
- "disabled": true,
32
- "items": [
33
- {
34
- "text": "Huesca"
35
- },
36
- {
37
- "text": "Zaragoza"
38
- },
39
- {
40
- "text": "Teruel"
41
- }
18
+ id: "ds-combobox-disabled",
19
+ name: "ds-combobox-disabled",
20
+ label: { text: "Esto es un label" },
21
+ disabled: true,
22
+ items: [
23
+ { text: "Huesca" },
24
+ { text: "Zaragoza" },
25
+ { text: "Teruel" }
42
26
  ]
43
27
  }) }}
44
28
  </div>
45
29
  <div>
46
30
  {{ componentCombobox({
47
- "id": "ds-combobox-hint",
48
- "name": "ds-combobox-hint",
49
- "label": {
50
- "text": "Provincia"
51
- },
52
- "hint": {
53
- "text": "Selecciona tu provincia"
54
- },
55
- "items": [
56
- {
57
- "text": "Huesca"
58
- },
59
- {
60
- "text": "Zaragoza"
61
- },
62
- {
63
- "text": "Teruel"
64
- }
31
+ id: "ds-combobox-hint",
32
+ name: "ds-combobox-hint",
33
+ label: { text: "Esto es un label" },
34
+ hint: { text: "Esto es un hint" },
35
+ items: [
36
+ { text: "Huesca" },
37
+ { text: "Zaragoza" },
38
+ { text: "Teruel" }
65
39
  ]
66
40
  }) }}
67
41
  </div>
68
- <div class="self-end">
42
+ <div>
43
+ {{ componentCombobox({
44
+ id: "ds-combobox-error",
45
+ name: "ds-combobox-error",
46
+ label: { text: "Esto es un label" },
47
+ errorMessage: { text: "Esto es un mensaje de error" },
48
+ items: [
49
+ { text: "Huesca" },
50
+ { text: "Zaragoza" },
51
+ { text: "Teruel" }
52
+ ]
53
+ }) }}
54
+ </div>
55
+ <div>
56
+ {{ componentCombobox({
57
+ id: "ds-combobox-hint-error",
58
+ name: "ds-combobox-hint-error",
59
+ label: { text: "Esto es un label" },
60
+ hint: { text: "Esto es un hint" },
61
+ errorMessage: { text: "Esto es un mensaje de error" },
62
+ items: [
63
+ { text: "Huesca" },
64
+ { text: "Zaragoza" },
65
+ { text: "Teruel" }
66
+ ]
67
+ }) }}
68
+ </div>
69
+ </div>
70
+
71
+ <div class="grid lg:grid-cols-5 gap-xl mb-lg items-end">
72
+ <div>
73
+ {{ componentCombobox({
74
+ id: "ds-combobox-placeholder",
75
+ name: "ds-combobox-placeholder",
76
+ label: { text: "Esto es un label" },
77
+ placeholder: "Escribe para buscar...",
78
+ items: [
79
+ { text: "Huesca" },
80
+ { text: "Zaragoza" },
81
+ { text: "Teruel" }
82
+ ]
83
+ }) }}
84
+ </div>
85
+ <div>
86
+ {{ componentCombobox({
87
+ id: "ds-combobox-default-value",
88
+ name: "ds-combobox-default-value",
89
+ label: { text: "Esto es un label" },
90
+ defaultValue: "Zaragoza",
91
+ items: [
92
+ { text: "Huesca" },
93
+ { text: "Zaragoza", selected: true },
94
+ { text: "Teruel" }
95
+ ]
96
+ }) }}
97
+ </div>
98
+ <div>
99
+ {{ componentCombobox({
100
+ id: "ds-combobox-autocomplete-list",
101
+ name: "ds-combobox-autocomplete-list",
102
+ label: { text: "Esto es un label" },
103
+ autocomplete: "list",
104
+ items: [
105
+ { text: "Huesca" },
106
+ { text: "Zaragoza" },
107
+ { text: "Teruel" }
108
+ ]
109
+ }) }}
110
+ </div>
111
+ <div>
112
+ {{ componentCombobox({
113
+ id: "ds-combobox-multiselect",
114
+ name: "ds-combobox-multiselect[]",
115
+ label: { text: "Esto es un label" },
116
+ multiselect: true,
117
+ placeholder: "Selecciona opciones",
118
+ items: [
119
+ { text: "Huesca", selected: true },
120
+ { text: "Zaragoza", selected: true },
121
+ { text: "Teruel" }
122
+ ]
123
+ }) }}
124
+ </div>
125
+ <div>
126
+ {{ componentCombobox({
127
+ id: "ds-combobox-sm",
128
+ name: "ds-combobox-sm",
129
+ classes: "c-combobox--sm",
130
+ label: { text: "Esto es un label", classes: "text-sm" },
131
+ items: [
132
+ { text: "Opción 1" },
133
+ { text: "Opción 2", selected: true },
134
+ { text: "Opción 3" }
135
+ ]
136
+ }) }}
137
+ </div>
138
+ </div>
139
+
140
+ <div class="grid lg:grid-cols-2 gap-xl mb-lg items-end">
141
+ <div>
142
+ {{ componentCombobox({
143
+ id: "ds-combobox-multiselect-extended",
144
+ name: "ds-combobox-multiselect-extended[]",
145
+ label: { text: "Esto es un label" },
146
+ multiselect: true,
147
+ autocomplete: "list",
148
+ placeholder: "Selecciona varias opciones",
149
+ items: [
150
+ { text: "Huesca", selected: true },
151
+ { text: "Zaragoza", selected: true },
152
+ { text: "Teruel" },
153
+ { text: "Barcelona" },
154
+ { text: "Madrid" },
155
+ { text: "Valencia" }
156
+ ]
157
+ }) }}
158
+ </div>
159
+ <div>
69
160
  {{ componentCombobox({
70
- "id": "ds-combobox-error",
71
- "name": "ds-combobox-error",
72
- "label": {
73
- "text": "Provincia"
161
+ id: "ds-combobox-inline",
162
+ name: "ds-combobox-inline",
163
+ classes: "lg:flex-1",
164
+ formGroup: {
165
+ classes: "lg:flex lg:flex-wrap lg:items-center lg:gap-x-base"
74
166
  },
75
- "errorMessage": {
76
- "text": "Selecciona una provincia válida"
167
+ label: {
168
+ text: "Esto es un label",
169
+ classes: "lg:py-sm lg:mt-sm"
77
170
  },
78
- "items": [
79
- {
80
- "text": "Huesca"
81
- },
82
- {
83
- "text": "Zaragoza"
84
- },
85
- {
86
- "text": "Teruel"
87
- }
171
+ items: [
172
+ { text: "Huesca" },
173
+ { text: "Zaragoza" },
174
+ { text: "Teruel" }
88
175
  ]
89
176
  }) }}
90
177
  </div>
@@ -61,13 +61,4 @@
61
61
  }) }}
62
62
  {% include "ds/_ds.example.tree.njk" %}
63
63
  <div class="pb-lg"></div>
64
- {{ DSSubsectionTitle({
65
- title: "Listbox por defecto"
66
- }) }}
67
- {% include "ds/_ds.example.listbox-default.njk" %}
68
- <div class="pb-lg"></div>
69
- {{ DSSubsectionTitle({
70
- title: "Listbox variaciones"
71
- }) }}
72
- {% include "ds/_ds.example.listbox-variaciones.njk" %}
73
64
  </div>
package/docs/index.html CHANGED
@@ -147,6 +147,16 @@ cd desy-html</code></pre>
147
147
 
148
148
  <h2>Changelog (English)</h2>
149
149
  <p>What's new in the latest version of desy-html</p>
150
+ <h3>v.17.0.2</h3>
151
+ <ul class="text-sm">
152
+ <li>Improvements in Combobox.</li>
153
+ <li>Removed Listbox from Catálogo as its deprecated.</li>
154
+ </ul>
155
+ <h3>v.17.0.1</h3>
156
+ <ul class="text-sm">
157
+ <li>Security fixes from deepsec.</li>
158
+ <li>Fixed a bug that avoid using breakpoint variants in desy-html-starter.</li>
159
+ </ul>
150
160
  <h3>v.17.0.0</h3>
151
161
  <ul class="text-sm">
152
162
  <li>Added Combobox component.</li>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desy-html",
3
- "version": "17.0.0",
3
+ "version": "17.0.2",
4
4
  "description": "desy-html contains the code you need to start building a user interface for Gobierno de Aragón government webapps.",
5
5
  "type": "module",
6
6
  "author": {
@@ -40,13 +40,13 @@
40
40
  "@floating-ui/dom": "^1.6.13",
41
41
  "@tailwindcss/forms": "^0.5.10",
42
42
  "@tailwindcss/typography": "^0.5.18",
43
- "@tailwindcss/vite": "^4.1.17",
43
+ "@tailwindcss/vite": "^4.2",
44
44
  "autoprefixer": "^10.4.21",
45
45
  "cally": "^0.8.0",
46
46
  "chokidar": "^3.6.0",
47
47
  "hex-rgb": "^5.0.0",
48
48
  "js-yaml": "^4.1.0",
49
- "tailwindcss": "^4.1.17"
49
+ "tailwindcss": "^4.2"
50
50
  },
51
51
  "devDependencies": {
52
52
  "cross-env": "^10.1.0",
@@ -36,18 +36,16 @@ export function MenuHorizontal(aria) {
36
36
  aria.MenuHorizontal.prototype.deactivateElement = function (elementDeactivated) {
37
37
  elementDeactivated.removeAttribute('aria-current');
38
38
  elementDeactivated.classList.remove('c-menu-horizontal__active');
39
- if(elementDeactivated.querySelector('strong')) {
40
- const getStrong = elementDeactivated.querySelector('strong');
41
- getStrong.classList.remove('font-bold');
42
- const replaceStrong = elementDeactivated.innerHTML.replace('strong', 'span');
43
- elementDeactivated.innerHTML = `${replaceStrong}`;
39
+ const getStrong = elementDeactivated.querySelector('strong');
40
+ if (getStrong) {
41
+ getStrong.replaceWith(...getStrong.childNodes);
44
42
  }
45
43
  };
46
44
 
47
45
  window.activateItemMenuHorizontal = function (menuId, activeItemId) {
48
46
  const menu = document.getElementById(menuId);
49
47
  if (menu) {
50
- const activeItem = document.querySelector(`#${menuId} #${activeItemId}`);
48
+ const activeItem = menu.querySelector('#' + CSS.escape(activeItemId));
51
49
  if (activeItem) {
52
50
  const menuInstance = new aria.MenuHorizontal(menu);
53
51
  menuInstance.activateElement(activeItemId);
@@ -84,6 +84,9 @@ export function MenuNavigation(aria) {
84
84
  const getAllLiElements = this.rootNode.querySelectorAll('li');
85
85
  [...getAllLiElements].forEach((element) => {
86
86
  const getElement = element.querySelector('a');
87
+ if (!getElement) {
88
+ return;
89
+ }
87
90
  if (getElement.id === elementActive) {
88
91
  this.wrapActiveElement(getElement);
89
92
  } else {
@@ -93,7 +96,7 @@ export function MenuNavigation(aria) {
93
96
  };
94
97
 
95
98
  aria.MenuNavigation.prototype.activateSubElement = function (menuId, elementActive) {
96
- const getAllLinks = this.rootNode.querySelectorAll(`#${menuId} ul li li a`);
99
+ const getAllLinks = this.rootNode.querySelectorAll(`#${CSS.escape(menuId)} ul li li a`);
97
100
  [...getAllLinks].forEach((link) => {
98
101
  if(link.id === elementActive) {
99
102
  link.setAttribute('aria-current', 'page');
@@ -104,10 +107,10 @@ export function MenuNavigation(aria) {
104
107
  getElementParent.removeAttribute('aria-current');
105
108
  const mainSpanParent2 = getElementParent.querySelector('span:not(.sr-only)');
106
109
  if (mainSpanParent2) {
107
- mainSpanParent2.innerHTML = mainSpanParent2.textContent;
110
+ unwrapStrong(mainSpanParent2);
108
111
  }
109
112
  link.removeAttribute('aria-current');
110
- link.innerHTML = `${link.textContent}`;
113
+ unwrapStrong(link);
111
114
  }
112
115
  });
113
116
  [...getAllLinks].forEach((link) => {
@@ -129,16 +132,29 @@ export function MenuNavigation(aria) {
129
132
  elementActive.innerHTML = `<strong class="font-bold">${elementActive.textContent}</strong>`;
130
133
  };
131
134
 
135
+ // Unwrap the <strong> of `node` in place, preserving the rest of its markup.
136
+ // If there is no <strong> (e.g. a never-activated sibling with its own
137
+ // icon/span), the node is left untouched instead of flattened to text.
138
+ function unwrapStrong(node) {
139
+ if (!node) return;
140
+ const strong = node.querySelector('strong');
141
+ if (!strong) return;
142
+ while (strong.firstChild) {
143
+ strong.parentNode.insertBefore(strong.firstChild, strong);
144
+ }
145
+ strong.remove();
146
+ }
147
+
132
148
  aria.MenuNavigation.prototype.deactivateElement = function (elementDeactivated) {
133
149
  elementDeactivated.removeAttribute('aria-current');
134
150
  elementDeactivated.classList.remove('c-menu-navigation__button--primary', 'c-menu-navigation__button--has-selection');
135
- elementDeactivated.innerHTML = elementDeactivated.textContent;
151
+ unwrapStrong(elementDeactivated);
136
152
  };
137
153
 
138
154
  window.activateItemMenuNavigation = function (menuId, activeItemId) {
139
155
  const menu = document.getElementById(menuId);
140
156
  if (menu) {
141
- const activeItem = document.querySelector(`#${menuId} #${activeItemId}`);
157
+ const activeItem = menu.querySelector('#' + CSS.escape(activeItemId));
142
158
  if (activeItem) {
143
159
  const menuInstance = new aria.MenuNavigation(menu);
144
160
  menuInstance.activateElement(activeItemId);
@@ -156,7 +172,7 @@ export function MenuNavigation(aria) {
156
172
  window.activateSubItemMenuNavigation = function (menuId, activeSubItemId) {
157
173
  const menu = document.getElementById(menuId);
158
174
  if (menu) {
159
- const activeSubItem = document.querySelector(`#${menuId} #${activeSubItemId}`);
175
+ const activeSubItem = menu.querySelector('#' + CSS.escape(activeSubItemId));
160
176
  if (activeSubItem) {
161
177
  const menuInstance = new aria.MenuNavigation(menu);
162
178
  menuInstance.activateSubElement(menuId, activeSubItemId);
@@ -327,51 +343,4 @@ export function MenuNavigation(aria) {
327
343
  aria.MenuNavigation.prototype.updateKeyControls = function (useArrowKeys) {
328
344
  this.useArrowKeys = useArrowKeys;
329
345
  };
330
-
331
- window.addEventListener(
332
- 'load',
333
- function () {
334
- var menus = document.querySelectorAll('.disclosure-nav');
335
- var disclosureMenus = [];
336
-
337
- for (var i = 0; i < menus.length; i++) {
338
- disclosureMenus[i] = new DisclosureNav(menus[i]);
339
- }
340
-
341
- // listen to arrow key checkbox
342
- var arrowKeySwitch = document.getElementById('arrow-behavior-switch');
343
- if (arrowKeySwitch) {
344
- arrowKeySwitch.addEventListener('change', function () {
345
- var checked = arrowKeySwitch.checked;
346
- for (var i = 0; i < disclosureMenus.length; i++) {
347
- disclosureMenus[i].updateKeyControls(checked);
348
- }
349
- });
350
- }
351
-
352
- // fake link behavior
353
- disclosureMenus.forEach((disclosureNav, i) => {
354
- var links = menus[i].querySelectorAll('[href="#mythical-page-content"]');
355
- var examplePageHeading = document.getElementById('mythical-page-heading');
356
- for (var k = 0; k < links.length; k++) {
357
- // The codepen export script updates the internal link href with a full URL
358
- // we're just manually fixing that behavior here
359
- links[k].href = '#mythical-page-content';
360
-
361
- links[k].addEventListener('click', (event) => {
362
- // change the heading text to fake a page change
363
- var pageTitle = event.target.innerText;
364
- examplePageHeading.innerText = pageTitle;
365
-
366
- // handle aria-current
367
- for (var n = 0; n < links.length; n++) {
368
- links[n].removeAttribute('aria-current');
369
- }
370
- event.target.setAttribute('aria-current', 'page');
371
- });
372
- }
373
- });
374
- },
375
- false
376
- );
377
346
  }
@@ -33,16 +33,16 @@ export function MenuVertical(aria) {
33
33
 
34
34
  aria.MenuVertical.prototype.deactivateElement = function (elementDeactivated) {
35
35
  elementDeactivated.removeAttribute('aria-current');
36
- if(elementDeactivated.querySelector('strong')) {
37
- const replaceStrong = elementDeactivated.innerHTML.replace('<strong class="font-bold">', '').replace('<strong/>', '');
38
- elementDeactivated.innerHTML = `${replaceStrong}`;
36
+ const getStrong = elementDeactivated.querySelector('strong');
37
+ if (getStrong) {
38
+ getStrong.replaceWith(...getStrong.childNodes);
39
39
  }
40
40
  };
41
41
 
42
42
  window.activateItemMenuVertical = function (menuId, activeItemId) {
43
43
  const menu = document.getElementById(menuId);
44
44
  if (menu) {
45
- const activeItem = document.querySelector(`#${menuId} #${activeItemId}`);
45
+ const activeItem = menu.querySelector('#' + CSS.escape(activeItemId));
46
46
  if (activeItem) {
47
47
  const menuInstance = new aria.MenuVertical(menu);
48
48
  menuInstance.activateElement(activeItemId);
@@ -24,7 +24,7 @@ export function MenubarAction(aria) {
24
24
  var msgPrefix = 'Menubar constructor argument domNode ';
25
25
 
26
26
  // Check whether domNode is a DOM element
27
- if (!domNode instanceof Element) {
27
+ if (!(domNode instanceof Element)) {
28
28
  throw new TypeError(msgPrefix + 'is not a DOM Element.');
29
29
  }
30
30
 
@@ -218,14 +218,14 @@ export function MenubarAction(aria) {
218
218
  if (!this.isItemDisabled(this.menubarItems[index])) {
219
219
  this.menubarItems[index].domNode.focus();
220
220
  this.menubarItems[index].domNode.tabIndex = 0;
221
- currentItem.tabIndex = -1;
221
+ currentItem.domNode.tabIndex = -1;
222
222
  } else {
223
223
  // Find the next enabled item that starts with the same character
224
224
  var nextEnabledIndex = this.findNextEnabledItemWithChar(index, char);
225
225
  if (nextEnabledIndex !== -1) {
226
226
  this.menubarItems[nextEnabledIndex].domNode.focus();
227
227
  this.menubarItems[nextEnabledIndex].domNode.tabIndex = 0;
228
- currentItem.tabIndex = -1;
228
+ currentItem.domNode.tabIndex = -1;
229
229
  }
230
230
  }
231
231
  }
@@ -293,7 +293,7 @@ export function MenubarAction(aria) {
293
293
  };
294
294
 
295
295
  aria.MenubarAction.prototype.activateElements = function (menuId, activateElements) {
296
- const getAllElements = this.domNode.querySelectorAll(`#${menuId} ul > li `);
296
+ const getAllElements = this.domNode.querySelectorAll(`#${CSS.escape(menuId)} ul > li `);
297
297
  const filterElements = [...getAllElements].filter((element) => element.id !== '' && element.getAttribute('role') !== 'separator');
298
298
  [...filterElements].forEach((element) => {
299
299
  if(isActive(element)) {
@@ -305,7 +305,7 @@ export function MenubarAction(aria) {
305
305
  : element.parentElement.parentElement.querySelector('a');
306
306
 
307
307
  getElementParent.classList.remove('c-menubar__button--has-selection');
308
- getElementParent.firstChild.innerHTML = `${getElementParent.textContent}`;
308
+ unwrapStrong(getElementParent.firstElementChild);
309
309
  element.setAttribute('aria-checked', 'false');
310
310
  element.innerHTML = `${element.textContent}`;
311
311
  }
@@ -316,10 +316,33 @@ export function MenubarAction(aria) {
316
316
  ? element.parentElement.parentElement.parentElement.parentElement.querySelector('a')
317
317
  : element.parentElement.parentElement.querySelector('a');
318
318
  getElementParent.classList.add('c-menubar__button--has-selection');
319
- getElementParent.firstChild.innerHTML = `<strong class="font-bold">${getElementParent.textContent}</strong>`;
319
+ wrapStrong(getElementParent.firstElementChild);
320
320
  }
321
321
  });
322
322
 
323
+ // Wrap the existing children of `node` in a <strong> in place, preserving
324
+ // any markup the consumer put in the label (icons, SVG, spans).
325
+ function wrapStrong(node) {
326
+ if (!node || node.querySelector('strong')) return;
327
+ const strong = document.createElement('strong');
328
+ strong.className = 'font-bold';
329
+ while (node.firstChild) {
330
+ strong.appendChild(node.firstChild);
331
+ }
332
+ node.appendChild(strong);
333
+ }
334
+
335
+ // Unwrap the <strong> of `node` in place, preserving the rest of its markup.
336
+ function unwrapStrong(node) {
337
+ if (!node) return;
338
+ const strong = node.querySelector('strong');
339
+ if (!strong) return;
340
+ while (strong.firstChild) {
341
+ strong.parentNode.insertBefore(strong.firstChild, strong);
342
+ }
343
+ strong.remove();
344
+ }
345
+
323
346
  function isActive(element){
324
347
  const { id } = element;
325
348
  return typeof activateElements === "string"
@@ -65,8 +65,7 @@ export function MenubarItemAction(aria) {
65
65
  };
66
66
 
67
67
  aria.MenubarItemAction.prototype.handleKeydown = function (event) {
68
- var tgt = event.currentTarget,
69
- char = event.key,
68
+ var char = event.key,
70
69
  flag = false;
71
70
 
72
71
  function isPrintableCharacter (str) {
@@ -127,13 +126,6 @@ export function MenubarItemAction(aria) {
127
126
  flag = true;
128
127
  break;
129
128
 
130
- case this.keyCode.ESC:
131
- if (this.popupMenu) {
132
- this.popupMenu.close();
133
- }
134
- flag = true;
135
- break;
136
-
137
129
  default:
138
130
  if (isPrintableCharacter(char)) {
139
131
  this.menubar.setFocusByFirstCharacter(this, char);
@@ -33,16 +33,16 @@ export function Nav(aria) {
33
33
 
34
34
  aria.Nav.prototype.deactivateElement = function (elementDeactivated) {
35
35
  elementDeactivated.removeAttribute('aria-current');
36
- if(elementDeactivated.querySelector('strong')) {
37
- const replaceStrong = elementDeactivated.innerHTML.replace('<strong class="font-bold">', '').replace('<strong/>', '');
38
- elementDeactivated.innerHTML = `${replaceStrong}`;
36
+ const getStrong = elementDeactivated.querySelector('strong');
37
+ if (getStrong) {
38
+ getStrong.replaceWith(...getStrong.childNodes);
39
39
  }
40
40
  };
41
41
 
42
42
  window.activateItemNav = function (menuId, activeItemId) {
43
43
  const menu = document.getElementById(menuId);
44
44
  if (menu) {
45
- const activeItem = document.querySelector(`#${menuId} #${activeItemId}`);
45
+ const activeItem = menu.querySelector('#' + CSS.escape(activeItemId));
46
46
  if (activeItem) {
47
47
  const menuInstance = new aria.Nav(menu);
48
48
  menuInstance.activateElement(activeItemId);
@@ -35,7 +35,7 @@ export function PopupMenuAction(aria) {
35
35
  msgPrefix = 'PopupMenu constructor argument domNode ';
36
36
 
37
37
  // Check whether domNode is a DOM element
38
- if (!domNode instanceof Element) {
38
+ if (!(domNode instanceof Element)) {
39
39
  throw new TypeError(msgPrefix + 'is not a DOM Element.');
40
40
  }
41
41
 
@@ -71,7 +71,7 @@ export function PopupMenuAction(aria) {
71
71
  this.domNode.setAttribute('role', 'menu');
72
72
 
73
73
  if (!this.domNode.getAttribute('aria-labelledby') && !this.domNode.getAttribute('aria-label') && !this.domNode.getAttribute('title')) {
74
- label = this.controller.domNode.innerHTML;
74
+ label = this.controller.domNode.textContent.trim();
75
75
  this.domNode.setAttribute('aria-label', label);
76
76
  }
77
77