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.
@@ -1374,7 +1374,10 @@ function close(popover) {
1374
1374
  // Update state class
1375
1375
  popover.target.classList.remove(this.settings.stateActive); // Update a11y attributes
1376
1376
 
1377
- popover.trigger.setAttribute('aria-expanded', 'false'); // Disable popper event listeners
1377
+ if (popover.trigger.hasAttribute('aria-controls')) {
1378
+ popover.trigger.setAttribute('aria-expanded', 'false');
1379
+ } // Disable popper event listeners
1380
+
1378
1381
 
1379
1382
  popover.popper.setOptions({
1380
1383
  modifiers: [{
@@ -1582,6 +1585,9 @@ function getPopoverID(obj) {
1582
1585
  // If it's a popover trigger
1583
1586
  if (obj.hasAttribute('aria-controls')) {
1584
1587
  return obj.getAttribute('aria-controls');
1588
+ } // If it's a popover tooltip trigger
1589
+ else if (obj.hasAttribute('aria-describedby')) {
1590
+ return obj.getAttribute('aria-describedby');
1585
1591
  } // If it's a popover target
1586
1592
  else if (obj.closest(this.settings.selectorPopover)) {
1587
1593
  return obj.id;
@@ -1597,7 +1603,7 @@ function getPopoverElements(query) {
1597
1603
  var id = getPopoverID.call(this, query);
1598
1604
 
1599
1605
  if (id) {
1600
- var trigger = document.querySelector("[aria-controls=\"" + id + "\"]");
1606
+ var trigger = document.querySelector("[aria-controls=\"" + id + "\"]") || document.querySelector("[aria-describedby=\"" + id + "\"]");
1601
1607
  var target = document.querySelector("#" + id);
1602
1608
 
1603
1609
  if (!trigger && !target) {
@@ -3409,7 +3415,10 @@ function open(popover) {
3409
3415
  // Update state class
3410
3416
  popover.target.classList.add(this.settings.stateActive); // Update a11y attribute
3411
3417
 
3412
- popover.trigger.setAttribute('aria-expanded', 'true'); // Update popover config
3418
+ if (popover.trigger.hasAttribute('aria-controls')) {
3419
+ popover.trigger.setAttribute('aria-expanded', 'true');
3420
+ } // Update popover config
3421
+
3413
3422
 
3414
3423
  popover.config = getConfig(popover.target, this.settings); // Enable popper event listeners and set placement/modifiers
3415
3424