vrembem 1.41.0 → 1.42.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.
@@ -1179,7 +1179,10 @@ function close(popover) {
1179
1179
  // Update state class
1180
1180
  popover.target.classList.remove(this.settings.stateActive); // Update a11y attributes
1181
1181
 
1182
- popover.trigger.setAttribute('aria-expanded', 'false'); // Disable popper event listeners
1182
+ if (popover.trigger.hasAttribute('aria-controls')) {
1183
+ popover.trigger.setAttribute('aria-expanded', 'false');
1184
+ } // Disable popper event listeners
1185
+
1183
1186
 
1184
1187
  popover.popper.setOptions({
1185
1188
  modifiers: [{
@@ -1385,6 +1388,9 @@ function getPopoverID(obj) {
1385
1388
  // If it's a popover trigger
1386
1389
  if (obj.hasAttribute('aria-controls')) {
1387
1390
  return obj.getAttribute('aria-controls');
1391
+ } // If it's a popover tooltip trigger
1392
+ else if (obj.hasAttribute('aria-describedby')) {
1393
+ return obj.getAttribute('aria-describedby');
1388
1394
  } // If it's a popover target
1389
1395
  else if (obj.closest(this.settings.selectorPopover)) {
1390
1396
  return obj.id;
@@ -1400,7 +1406,7 @@ function getPopoverElements(query) {
1400
1406
  const id = getPopoverID.call(this, query);
1401
1407
 
1402
1408
  if (id) {
1403
- const trigger = document.querySelector(`[aria-controls="${id}"]`);
1409
+ const trigger = document.querySelector(`[aria-controls="${id}"]`) || document.querySelector(`[aria-describedby="${id}"]`);
1404
1410
  const target = document.querySelector(`#${id}`);
1405
1411
 
1406
1412
  if (!trigger && !target) {
@@ -3212,7 +3218,10 @@ function open(popover) {
3212
3218
  // Update state class
3213
3219
  popover.target.classList.add(this.settings.stateActive); // Update a11y attribute
3214
3220
 
3215
- popover.trigger.setAttribute('aria-expanded', 'true'); // Update popover config
3221
+ if (popover.trigger.hasAttribute('aria-controls')) {
3222
+ popover.trigger.setAttribute('aria-expanded', 'true');
3223
+ } // Update popover config
3224
+
3216
3225
 
3217
3226
  popover.config = getConfig(popover.target, this.settings); // Enable popper event listeners and set placement/modifiers
3218
3227