From 144c548d3eeeaec6054057f124e73bbb8928c73b Mon Sep 17 00:00:00 2001 From: Westbrook Johnson Date: Mon, 24 May 2021 08:26:30 -0400 Subject: [PATCH] fix: no scroll update when managing elements outside of the tab order --- packages/shared/src/focusable.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/shared/src/focusable.ts b/packages/shared/src/focusable.ts index 64c6abbd46..38e7c09658 100644 --- a/packages/shared/src/focusable.ts +++ b/packages/shared/src/focusable.ts @@ -126,7 +126,7 @@ export class Focusable extends FocusVisiblePolyfillMixin(SpectrumElement) { private onPointerdownManagementOfTabIndex(): void { if (this.tabIndex === -1) { this.tabIndex = 0; - this.focus(); + this.focus({ preventScroll: true }); } } @@ -151,15 +151,15 @@ export class Focusable extends FocusVisiblePolyfillMixin(SpectrumElement) { throw new Error('Must implement focusElement getter!'); } - public focus(): void { + public focus(options?: FocusOptions): void { if (this.disabled || !this.focusElement) { return; } if (this.focusElement !== this) { - this.focusElement.focus(); + this.focusElement.focus(options); } else { - HTMLElement.prototype.focus.apply(this); + HTMLElement.prototype.focus.apply(this, [options]); } }