From 5cfe270b36230493ef07c43d0313f51945200ed4 Mon Sep 17 00:00:00 2001 From: "David Richards, Jr" Date: Wed, 11 Oct 2023 11:22:11 -0400 Subject: [PATCH] fix(FocusManager): call super in _focus and _unfocus without smoothing --- .../ui-components/src/components/Base/Base.js | 8 +++++++- .../src/components/FocusManager/FocusManager.js | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/@lightningjs/ui-components/src/components/Base/Base.js b/packages/@lightningjs/ui-components/src/components/Base/Base.js index 5f9e94edb..412e6151b 100644 --- a/packages/@lightningjs/ui-components/src/components/Base/Base.js +++ b/packages/@lightningjs/ui-components/src/components/Base/Base.js @@ -54,14 +54,20 @@ class Base extends lng.Component { _update() {} _focus() { - if (this.shouldSmooth === undefined) this.shouldSmooth = true; + super._focus(); + this._updateShouldSmooth(); this.queueRequestUpdate(); } _unfocus() { + super._unfocus(); this.queueRequestUpdate(); } + _updateShouldSmooth() { + if (this.shouldSmooth === undefined) this.shouldSmooth = true; + } + /** * This method accepts a target component, patch object, and optional smooth object. * If the component is visible, it will smooth in the smooth object, or fall back to diff --git a/packages/@lightningjs/ui-components/src/components/FocusManager/FocusManager.js b/packages/@lightningjs/ui-components/src/components/FocusManager/FocusManager.js index 7f6d0e61e..9dad372e3 100644 --- a/packages/@lightningjs/ui-components/src/components/FocusManager/FocusManager.js +++ b/packages/@lightningjs/ui-components/src/components/FocusManager/FocusManager.js @@ -327,12 +327,16 @@ export default class FocusManager extends Base { * Element/Pattern Components (Tile, Badge, etc.) would extend "BaseComponent" that does have focus/unfocus overrides */ _focus() { + super._focus(); this.items.forEach(item => (item.parentFocus = true)); } _unfocus() { + super._unfocus(); this.items.forEach(item => (item.parentFocus = false)); } + _updateShouldSmooth() {} + _getFocused() { const { selected } = this; // Make sure we're focused on a component