@brightspace-ui/core 3.338.1 → 3.338.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.
@@ -3,7 +3,6 @@ import '../icons/icon.js';
3
3
  import '../tooltip/tooltip.js';
4
4
  import { css, html, LitElement, nothing } from 'lit';
5
5
  import { buttonStyles } from './button-styles.js';
6
- import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
7
6
  import { getUniqueId } from '../../helpers/uniqueId.js';
8
7
  import { ifDefined } from 'lit/directives/if-defined.js';
9
8
  import { labelStyles } from '../typography/styles.js';
@@ -13,7 +12,7 @@ import { PropertyRequiredMixin } from '../../mixins/property-required/property-r
13
12
  /**
14
13
  * A navigation control for moving sequentially through a set of items.
15
14
  */
16
- class ButtonIterator extends FocusMixin(PropertyRequiredMixin(LocalizeCoreElement(LitElement))) {
15
+ class ButtonIterator extends PropertyRequiredMixin(LocalizeCoreElement(LitElement)) {
17
16
 
18
17
  static properties = {
19
18
  /**
@@ -84,11 +83,11 @@ class ButtonIterator extends FocusMixin(PropertyRequiredMixin(LocalizeCoreElemen
84
83
  min-width: calc(2rem + 2px);
85
84
  padding: 0;
86
85
  }
87
- button:not([disabled]):hover,
88
- button:not([disabled]):focus {
86
+ button:not([aria-disabled]):hover,
87
+ button:not([aria-disabled]):focus {
89
88
  background-color: var(--d2l-theme-background-color-interactive-secondary-hover);
90
89
  }
91
- button[disabled] {
90
+ button[aria-disabled] {
92
91
  cursor: default;
93
92
  opacity: var(--d2l-theme-opacity-disabled-control);
94
93
  }
@@ -104,10 +103,6 @@ class ButtonIterator extends FocusMixin(PropertyRequiredMixin(LocalizeCoreElemen
104
103
  this.previousText = '';
105
104
  }
106
105
 
107
- static get focusElementSelector() {
108
- return 'button:not([disabled])';
109
- }
110
-
111
106
  render() {
112
107
  const nextText = this.nextText ? this.nextText : this.localizeCommon('navigation:next:title');
113
108
  if (this.nextOnly) {
@@ -129,13 +124,21 @@ class ButtonIterator extends FocusMixin(PropertyRequiredMixin(LocalizeCoreElemen
129
124
  `;
130
125
  }
131
126
 
127
+ focus() {
128
+ if (!this.previousDisabled || this.nextDisabled) {
129
+ this.shadowRoot.querySelector('button.previous').focus();
130
+ } else {
131
+ this.shadowRoot.querySelector('button.next').focus();
132
+ }
133
+ }
134
+
132
135
  #descriptionId = getUniqueId();
133
136
  #previousId = getUniqueId();
134
137
  #nextId = getUniqueId();
135
138
 
136
139
  #handleButtonClick(e) {
137
140
  const button = e.currentTarget;
138
- if (button.disabled) {
141
+ if (button.hasAttribute('aria-disabled')) {
139
142
  return;
140
143
  }
141
144
  e.stopPropagation();
@@ -149,25 +152,21 @@ class ButtonIterator extends FocusMixin(PropertyRequiredMixin(LocalizeCoreElemen
149
152
  }
150
153
 
151
154
  #renderButton(id, className, icon, text, descriptionId, disabled) {
152
- const ariaLabel = disabled ? text : undefined;
153
- const tooltip = !disabled ? html`
154
- <d2l-tooltip
155
- class="vdiff-target"
156
- for="${id}"
157
- for-type="label"
158
- position="bottom">${text}</d2l-tooltip>` : nothing;
159
155
  return html`
160
156
  <button
161
157
  aria-describedby="${ifDefined(descriptionId)}"
162
- aria-label="${ifDefined(ariaLabel)}"
158
+ aria-disabled="${ifDefined(disabled ? 'true' : undefined)}"
163
159
  class="${className}"
164
160
  @click="${this.#handleButtonClick}"
165
- ?disabled="${disabled}"
166
161
  id="${id}"
167
162
  type="button">
168
163
  <d2l-icon icon="${icon}"></d2l-icon>
169
164
  </button>
170
- ${tooltip}
165
+ <d2l-tooltip
166
+ class="vdiff-target"
167
+ for="${id}"
168
+ for-type="label"
169
+ position="bottom">${text}</d2l-tooltip>
171
170
  `;
172
171
  }
173
172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.338.1",
3
+ "version": "3.338.2",
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",