diff --git a/change/@microsoft-fast-foundation-452bb1d9-58ef-4cb0-a6fa-0ed41d1ad057.json b/change/@microsoft-fast-foundation-452bb1d9-58ef-4cb0-a6fa-0ed41d1ad057.json new file mode 100644 index 00000000000..332f1fa1066 --- /dev/null +++ b/change/@microsoft-fast-foundation-452bb1d9-58ef-4cb0-a6fa-0ed41d1ad057.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix: prevent toolbar from stealing focus when focus has already been moved in the document", + "packageName": "@microsoft/fast-foundation", + "email": "=", + "dependentChangeType": "patch" +} diff --git a/packages/web-components/fast-foundation/src/toolbar/toolbar.ts b/packages/web-components/fast-foundation/src/toolbar/toolbar.ts index 1475931faf4..71b151341d8 100644 --- a/packages/web-components/fast-foundation/src/toolbar/toolbar.ts +++ b/packages/web-components/fast-foundation/src/toolbar/toolbar.ts @@ -242,8 +242,9 @@ export class Toolbar extends FoundationElement { // If the previously active item is still focusable, adjust the active index to the // index of that item. - const adjustedActiveIndex = - this.focusableElements.indexOf(previousFocusedElement); + const adjustedActiveIndex = this.focusableElements.indexOf( + previousFocusedElement + ); this.activeIndex = Math.max(0, adjustedActiveIndex); this.setFocusableElements();