@momentum-design/components 0.32.1 → 0.33.1

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.
@@ -175,6 +175,11 @@ declare class Popover extends Popover_base {
175
175
  * aria-describedby of the popover.
176
176
  */
177
177
  ariaDescribedby: string | null;
178
+ /**
179
+ * Disable aria-expanded attribute on trigger element.
180
+ * @default false
181
+ */
182
+ disableAriaExpanded: boolean;
178
183
  arrowElement: HTMLElement | null;
179
184
  /** @internal */
180
185
  triggerElement: HTMLElement | null;
@@ -193,6 +193,11 @@ class Popover extends FocusTrapMixin(Component) {
193
193
  * aria-describedby of the popover.
194
194
  */
195
195
  this.ariaDescribedby = null;
196
+ /**
197
+ * Disable aria-expanded attribute on trigger element.
198
+ * @default false
199
+ */
200
+ this.disableAriaExpanded = DEFAULTS.DISABLE_ARIA_EXPANDED;
196
201
  this.arrowElement = null;
197
202
  /** @internal */
198
203
  this.triggerElement = null;
@@ -328,7 +333,7 @@ class Popover extends FocusTrapMixin(Component) {
328
333
  setupTriggerListener() {
329
334
  if (!this.triggerID)
330
335
  return;
331
- this.triggerElement = document.getElementById(this.triggerID);
336
+ this.triggerElement = this.getRootNode().querySelector(`#${this.triggerID}`);
332
337
  if (!this.triggerElement)
333
338
  return;
334
339
  if (this.trigger === 'mouseenter') {
@@ -450,7 +455,9 @@ class Popover extends FocusTrapMixin(Component) {
450
455
  if (this.hideOnEscape) {
451
456
  document.addEventListener('keydown', this.onEscapeKeydown);
452
457
  }
453
- this.triggerElement.setAttribute('aria-expanded', 'true');
458
+ if (!this.disableAriaExpanded) {
459
+ this.triggerElement.setAttribute('aria-expanded', 'true');
460
+ }
454
461
  if (this.interactive) {
455
462
  this.triggerElement.setAttribute('aria-haspopup', this.triggerElement.getAttribute('aria-haspopup') || 'dialog');
456
463
  }
@@ -475,7 +482,9 @@ class Popover extends FocusTrapMixin(Component) {
475
482
  document.removeEventListener('keydown', this.onEscapeKeydown);
476
483
  }
477
484
  (_b = this.deactivateFocusTrap) === null || _b === void 0 ? void 0 : _b.call(this);
478
- this.triggerElement.removeAttribute('aria-expanded');
485
+ if (!this.disableAriaExpanded) {
486
+ this.triggerElement.removeAttribute('aria-expanded');
487
+ }
479
488
  if (this.interactive) {
480
489
  this.triggerElement.removeAttribute('aria-haspopup');
481
490
  }
@@ -673,4 +682,8 @@ __decorate([
673
682
  property({ type: String, reflect: true, attribute: 'aria-describedby' }),
674
683
  __metadata("design:type", Object)
675
684
  ], Popover.prototype, "ariaDescribedby", void 0);
685
+ __decorate([
686
+ property({ type: Boolean, reflect: true, attribute: 'disable-aria-expanded' }),
687
+ __metadata("design:type", Boolean)
688
+ ], Popover.prototype, "disableAriaExpanded", void 0);
676
689
  export default Popover;
@@ -44,5 +44,6 @@ declare const DEFAULTS: {
44
44
  readonly DELAY: "0,0";
45
45
  readonly ROLE: "dialog";
46
46
  readonly Z_INDEX: 1000;
47
+ readonly DISABLE_ARIA_EXPANDED: false;
47
48
  };
48
49
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, TRIGGER, DEFAULTS };
@@ -45,5 +45,6 @@ const DEFAULTS = {
45
45
  DELAY: '0,0',
46
46
  ROLE: 'dialog',
47
47
  Z_INDEX: 1000,
48
+ DISABLE_ARIA_EXPANDED: false,
48
49
  };
49
50
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, TRIGGER, DEFAULTS };
@@ -6166,6 +6166,17 @@
6166
6166
  "attribute": "aria-describedby",
6167
6167
  "reflects": true
6168
6168
  },
6169
+ {
6170
+ "kind": "field",
6171
+ "name": "disableAriaExpanded",
6172
+ "type": {
6173
+ "text": "boolean"
6174
+ },
6175
+ "description": "Disable aria-expanded attribute on trigger element.",
6176
+ "default": "false",
6177
+ "attribute": "disable-aria-expanded",
6178
+ "reflects": true
6179
+ },
6169
6180
  {
6170
6181
  "kind": "field",
6171
6182
  "name": "arrowElement",
@@ -6993,6 +7004,15 @@
6993
7004
  "description": "aria-describedby of the popover.",
6994
7005
  "fieldName": "ariaDescribedby"
6995
7006
  },
7007
+ {
7008
+ "name": "disable-aria-expanded",
7009
+ "type": {
7010
+ "text": "boolean"
7011
+ },
7012
+ "description": "Disable aria-expanded attribute on trigger element.",
7013
+ "default": "false",
7014
+ "fieldName": "disableAriaExpanded"
7015
+ },
6996
7016
  {
6997
7017
  "name": "enabledFocusTrap",
6998
7018
  "type": {
package/package.json CHANGED
@@ -38,5 +38,5 @@
38
38
  "lit": "^3.2.0",
39
39
  "uuid": "^11.0.5"
40
40
  },
41
- "version": "0.32.1"
41
+ "version": "0.33.1"
42
42
  }