mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-19 07:29:14 +00:00
Compare commits
2 Commits
docs-fix
...
tree-focus
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
886049d714 | ||
|
|
848c059d51 |
@@ -18,6 +18,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti
|
|||||||
- Fixed a bug in `<sl-qr-code>` where the `background` attribute was never passed to the QR code [#1416]
|
- Fixed a bug in `<sl-qr-code>` where the `background` attribute was never passed to the QR code [#1416]
|
||||||
- Fixed a bug in `<sl-dropdown>` where aria attributes were incorrectly applied to the default `<slot>` causing Lighthouse errors [#1417]
|
- Fixed a bug in `<sl-dropdown>` where aria attributes were incorrectly applied to the default `<slot>` causing Lighthouse errors [#1417]
|
||||||
- Fixed a bug in `<sl-carousel>` that caused navigation to work incorrectly in some case [#1420]
|
- Fixed a bug in `<sl-carousel>` that caused navigation to work incorrectly in some case [#1420]
|
||||||
|
- Fixed a bug in `<sl-tree>` that caused focus to be stolen when removing focused tree items [#1430]
|
||||||
|
|
||||||
## 2.5.2
|
## 2.5.2
|
||||||
|
|
||||||
|
|||||||
@@ -159,14 +159,8 @@ export default class SlTree extends ShoelaceElement {
|
|||||||
private handleTreeChanged = (mutations: MutationRecord[]) => {
|
private handleTreeChanged = (mutations: MutationRecord[]) => {
|
||||||
for (const mutation of mutations) {
|
for (const mutation of mutations) {
|
||||||
const addedNodes: SlTreeItem[] = [...mutation.addedNodes].filter(SlTreeItem.isTreeItem) as SlTreeItem[];
|
const addedNodes: SlTreeItem[] = [...mutation.addedNodes].filter(SlTreeItem.isTreeItem) as SlTreeItem[];
|
||||||
const removedNodes = [...mutation.removedNodes].filter(SlTreeItem.isTreeItem) as SlTreeItem[];
|
|
||||||
|
|
||||||
addedNodes.forEach(this.initTreeItem);
|
addedNodes.forEach(this.initTreeItem);
|
||||||
|
|
||||||
// If the focused item has been removed form the DOM, move the focus to the first focusable item
|
|
||||||
if (removedNodes.includes(this.lastFocusedItem)) {
|
|
||||||
this.focusItem(this.getFocusableItems()[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user