From bafe857271606fd65227e5176f490673b66fabed Mon Sep 17 00:00:00 2001 From: Xantios Krugor Date: Mon, 3 Aug 2020 14:20:31 +0200 Subject: [PATCH] Move focusManager to ES6 --- package.json | 1 + src/components/focusManager.js | 7 ++++--- src/controllers/list.js | 2 +- src/libraries/scroller.js | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f794b8b6da..eae461bb4f 100644 --- a/package.json +++ b/package.json @@ -110,6 +110,7 @@ "src/components/favoriteitems.js", "src/components/fetchhelper.js", "src/components/filterdialog/filterdialog.js", + "src/components/focusManager.js", "src/components/groupedcards.js", "src/components/homeScreenSettings/homeScreenSettings.js", "src/components/homesections/homesections.js", diff --git a/src/components/focusManager.js b/src/components/focusManager.js index 9c495bf952..1f947871de 100644 --- a/src/components/focusManager.js +++ b/src/components/focusManager.js @@ -1,4 +1,6 @@ -define(['dom', 'scrollManager'], function (dom, scrollManager) { +import dom from 'dom'; +import scrollManager from 'scrollManager'; + 'use strict'; var scopes = []; @@ -472,7 +474,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) { } } - return { + export default { autoFocus: autoFocus, focus: focus, focusableParent: focusableParent, @@ -505,4 +507,3 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) { focusLast: focusLast, moveFocus: moveFocus }; -}); diff --git a/src/controllers/list.js b/src/controllers/list.js index 68e81f05dd..a35b7a0cf9 100644 --- a/src/controllers/list.js +++ b/src/controllers/list.js @@ -771,7 +771,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager' loading.hide(); if (refresh) { - focusManager.autoFocus(self.itemsContainer); + focusManager.default.autoFocus(self.itemsContainer); } }); diff --git a/src/libraries/scroller.js b/src/libraries/scroller.js index c0cb3e557c..d869d8c8be 100644 --- a/src/libraries/scroller.js +++ b/src/libraries/scroller.js @@ -697,7 +697,7 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'ResizeObserver', 'sc function onFrameClick(e) { if (e.which === 1) { - var focusableParent = focusManager.focusableParent(e.target); + var focusableParent = focusManager.default.focusableParent(e.target); if (focusableParent && focusableParent !== document.activeElement) { focusableParent.focus(); }