mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
cycle through tabs/menu items
This commit is contained in:
@@ -13,7 +13,8 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
|
||||
- Fixed a bug that prevented `setCustomValidity()` from working with `<sl-radio-button>`
|
||||
- Fixed a bug where the right border of a checked `<sl-radio-button>` was the wrong color
|
||||
- Fixed a bug that prevented a number of properties, methods, etc. from being documented in `<sl-radio>` and `<sl-radio-button>`
|
||||
- Once again removed path aliasing because it doesn't work with Web Test Runner's esbuild plugin
|
||||
- Updated `<sl-tab-group>` and `<sl-menu>` to cycle through tabs and menu items instead of stopping at the first/last when using the keyboard
|
||||
- Removed path aliasing (again) because it doesn't work with Web Test Runner's esbuild plugin
|
||||
|
||||
## 2.0.0-beta.72
|
||||
|
||||
|
||||
@@ -162,10 +162,10 @@ export default class SlMenu extends LitElement {
|
||||
}
|
||||
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
index = items.length - 1;
|
||||
}
|
||||
if (index > items.length - 1) {
|
||||
index = items.length - 1;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
this.setCurrentItem(items[index]);
|
||||
|
||||
@@ -187,12 +187,20 @@ export default class SlTabGroup extends LitElement {
|
||||
(['top', 'bottom'].includes(this.placement) && event.key === 'ArrowLeft') ||
|
||||
(['start', 'end'].includes(this.placement) && event.key === 'ArrowUp')
|
||||
) {
|
||||
index = Math.max(0, index - 1);
|
||||
index--;
|
||||
} else if (
|
||||
(['top', 'bottom'].includes(this.placement) && event.key === 'ArrowRight') ||
|
||||
(['start', 'end'].includes(this.placement) && event.key === 'ArrowDown')
|
||||
) {
|
||||
index = Math.min(this.tabs.length - 1, index + 1);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index < 0) {
|
||||
index = this.tabs.length - 1;
|
||||
}
|
||||
|
||||
if (index > this.tabs.length - 1) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
this.tabs[index].focus({ preventScroll: true });
|
||||
|
||||
Reference in New Issue
Block a user