Skip to content

Commit

Permalink
fix(tags): performed the suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
blunteshwar authored and Westbrook committed Aug 18, 2023
1 parent 196bdae commit 6e3ef36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/tags/src/Tags.ts
Expand Up @@ -70,6 +70,7 @@ export class Tags extends FocusVisiblePolyfillMixin(SpectrumElement) {
private handleKeydown = (event: KeyboardEvent): void => {
const { code } = event;
if (code !== 'PageUp' && code !== 'PageDown') return;

const circularIndexedElement = <T extends HTMLElement>(
list: T[],
index: number
Expand Down
9 changes: 3 additions & 6 deletions tools/reactive-controllers/src/FocusGroup.ts
Expand Up @@ -130,7 +130,7 @@ export class FocusGroupController<T extends HTMLElement>
subtree: true,
},
callback: () => {
this.changeDefaultItemFocus();
this.handleItemMutation();
},
});
this.host = host;
Expand All @@ -155,12 +155,9 @@ export class FocusGroupController<T extends HTMLElement>
);
}

changeDefaultItemFocus(): void {
handleItemMutation(): void {
this.clearElementCache();
let diff = 0;
if (this.currentIndex === this.elements.length) {
diff = -1;
}
const diff = this.currentIndex === this.elements.length ? -1 : 0;
this.setCurrentIndexCircularly(diff);
let steps = this.elements.length;
while (
Expand Down

0 comments on commit 6e3ef36

Please sign in to comment.