From 6c69ab249b7432eb76718693efa4cc8c709035a1 Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Fri, 8 Sep 2023 11:57:25 +0400 Subject: [PATCH] fix review --- .../keyboard_navigation/m_keyboard_navigation.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts b/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts index ddb30b1e5ae5..5e0d6f534a5c 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts @@ -1740,12 +1740,10 @@ export class KeyboardNavigationController extends modules.ViewController { return rowIndex >= (dataController as any).getMaxRowIndex(); } - let lastVisibleIndex = -1; - dataController.items().forEach((item, i) => { - if (item.visible !== false) { - lastVisibleIndex = i; - } - }); + const lastVisibleIndex = Math.max( + ...dataController.items() + .map((item, index) => (item.visible ? index : -1)), + ); return rowIndex === lastVisibleIndex; }