tosijs-ui 1.5.21 → 1.5.22

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.
package/dist/menu.js CHANGED
@@ -995,8 +995,8 @@ export const createMenuAction = (item, options) => {
995
995
  if (item.tooltip) {
996
996
  menuItem.dataset.tooltip = item.tooltip;
997
997
  }
998
- if (options.role === 'listbox' && checked) {
999
- menuItem.setAttribute('aria-selected', 'true');
998
+ if (options.role === 'listbox') {
999
+ menuItem.toggleAttribute('aria-selected', checked !== false);
1000
1000
  }
1001
1001
  if (item?.enabled && !item.enabled()) {
1002
1002
  menuItem.setAttribute('disabled', '');
@@ -50,7 +50,7 @@ export declare class TosiTabs extends WebComponent {
50
50
  display: string;
51
51
  alignItems: string;
52
52
  };
53
- ':host .tabs > [aria-selected="true"]': {
53
+ ':host .tabs > [aria-selected]': {
54
54
  '--text-color': string;
55
55
  color: string;
56
56
  };
@@ -209,7 +209,7 @@ export class TosiTabs extends WebComponent {
209
209
  display: 'flex',
210
210
  alignItems: 'baseline',
211
211
  },
212
- ':host .tabs > [aria-selected="true"]': {
212
+ ':host .tabs > [aria-selected]': {
213
213
  '--text-color': vars.tosiTabsSelectedColor,
214
214
  color: vars.textColor,
215
215
  },
@@ -342,15 +342,12 @@ export class TosiTabs extends WebComponent {
342
342
  for (let i = 0; i < tabBodies.length; i++) {
343
343
  const tabBody = tabBodies[i];
344
344
  const tab = tabs.children[i];
345
- if (this.value === Number(i)) {
346
- tab.setAttribute('aria-selected', 'true');
345
+ const isSelected = this.value === Number(i);
346
+ tab.toggleAttribute('aria-selected', isSelected);
347
+ tabBody.toggleAttribute('hidden', !isSelected);
348
+ if (isSelected) {
347
349
  selected.style.marginLeft = `${tab.offsetLeft - tabs.offsetLeft}px`;
348
350
  selected.style.width = `${tab.offsetWidth}px`;
349
- tabBody.toggleAttribute('hidden', false);
350
- }
351
- else {
352
- tab.toggleAttribute('aria-selected', false);
353
- tabBody.toggleAttribute('hidden', true);
354
351
  }
355
352
  }
356
353
  }