Skip to content

Commit

Permalink
fix(tags): corner cases handled
Browse files Browse the repository at this point in the history
  • Loading branch information
blunteshwar authored and Westbrook committed Aug 18, 2023
1 parent 55a95b7 commit 8ec6b6a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tools/reactive-controllers/src/FocusGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,18 @@ export class FocusGroupController<T extends HTMLElement>
this._listenerScope
);
}

/*jkbdfjqwhfb qwk
*/
handleItemMutation(): void {
const focusedElement = this.elements[this.currentIndex];
if (
this._currentIndex == -1 ||
this.elements.length <= this._elements.length
)
return;
this.clearElementCache();
if (focusedElement == this.elements[this.currentIndex]) return;
const focusedElement = this.elements[this.currentIndex];
if (this.elements.includes(focusedElement)) return;

const moveToNextElement = this.currentIndex !== this.elements.length;
const diff = moveToNextElement ? 1 : -1;
if (moveToNextElement) {
Expand All @@ -179,6 +186,7 @@ export class FocusGroupController<T extends HTMLElement>
const elements = this.elements;
if (!elements.length) return;
let focusElement = elements[this.currentIndex];
//console.log(this.currentIndex);
if (!focusElement || !this.isFocusableElement(focusElement)) {
this.setCurrentIndexCircularly(1);
focusElement = elements[this.currentIndex];
Expand Down

0 comments on commit 8ec6b6a

Please sign in to comment.