Skip to content

Commit

Permalink
fix(tags): some extra chnages
Browse files Browse the repository at this point in the history
  • Loading branch information
blunteshwar authored and Westbrook committed Aug 18, 2023
1 parent 8aca49e commit 45f1a9d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/reactive-controllers/src/FocusGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ export class FocusGroupController<T extends HTMLElement>
Then we are checking if the deleted element was the focused one before the deletion if so then we need to proceed else we casn return;
*/
handleItemMutation(): void {
if (this._currentIndex == -1) return;
const lengthOfElementsBeforeMutation = this.elements.length;
if (
this._currentIndex == -1 ||
this.elements.length <= this._elements().length
)
return;
const focusedElement = this.elements[this.currentIndex];
this.clearElementCache();
if (lengthOfElementsBeforeMutation <= this.elements.length) return;
if (this.elements.includes(focusedElement)) return;
const moveToNextElement = this.currentIndex !== this.elements.length;
const diff = moveToNextElement ? 1 : -1;
Expand Down

0 comments on commit 45f1a9d

Please sign in to comment.