From 137be33a6cbf9a912ff2a17b059a124ec79394e1 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Fri, 6 Aug 2021 09:09:50 +0200 Subject: [PATCH] Fixes various issues with javascript services (#10800) --- .../common/directives/components/tree/umbtree.directive.js | 2 +- .../common/directives/util/umbkeyboardlist.directive.js | 7 +++---- .../src/common/services/navigation.service.js | 2 +- .../src/less/components/application/umb-search.less | 4 ++-- src/Umbraco.Web.UI.Client/src/utilities.js | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js index 4512494202..358223901e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js @@ -358,7 +358,7 @@ function umbTreeDirective($q, treeService, navigationService, notificationsServi */ $scope.select = function (n, ev) { - navigationService.closeBackdrop(); + navigationService.hideMenu(); if (n.metaData && n.metaData.noAccess === true) { ev.preventDefault(); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/util/umbkeyboardlist.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/util/umbkeyboardlist.directive.js index 3d8653386f..7658b4e043 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/util/umbkeyboardlist.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/util/umbkeyboardlist.directive.js @@ -32,20 +32,20 @@ angular.module('umbraco.directives') return { restrict: 'A', - link: function (scope, element, attr) { + link: function (scope, element) { var listItems = []; var currentIndex = 0; var focusSet = false; - $timeout(function(){ + $timeout(function() { // get list of all links in the list listItems = element.find("li :tabbable"); }); // Handle keydown events function keydown(event) { - $timeout(function(){ + $timeout(function() { checkFocus(); // arrow down if (event.keyCode === 40) { @@ -109,7 +109,6 @@ angular.module('umbraco.directives') // Stop listening when scope is destroyed. scope.$on('$destroy', stopListening); - } }; }]); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js index b2f66b176b..0685baabe8 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js @@ -127,7 +127,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService var aboveClass = "above-backdrop"; var leftColumn = document.getElementById("leftcolumn"); - if(leftColumn !== null) { + if(leftColumn) { var isLeftColumnOnTop = leftColumn.classList.contains(aboveClass); if (isLeftColumnOnTop) { diff --git a/src/Umbraco.Web.UI.Client/src/less/components/application/umb-search.less b/src/Umbraco.Web.UI.Client/src/less/components/application/umb-search.less index 30c50b71b3..f0423e5d2e 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/application/umb-search.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/application/umb-search.less @@ -16,7 +16,7 @@ box-shadow: 0 10px 20px rgba(0,0,0,.12),0 6px 6px rgba(0,0,0,.14); } -.umb-search__label{ +.umb-search__label { margin: 0; } @@ -33,7 +33,7 @@ height: 70px; } -.umb-search-input { +input.umb-search-input { width: 100%; height: 70px; border: none; diff --git a/src/Umbraco.Web.UI.Client/src/utilities.js b/src/Umbraco.Web.UI.Client/src/utilities.js index abbc287e0f..14e37ecb87 100644 --- a/src/Umbraco.Web.UI.Client/src/utilities.js +++ b/src/Umbraco.Web.UI.Client/src/utilities.js @@ -110,7 +110,7 @@ * Not equivalent to angular.forEach. But like the angularJS method this does not fail on null or undefined. */ const forEach = (obj, iterator) => { - if (obj) { + if (obj && isArray(obj)) { return obj.forEach(iterator); } return obj;