From cae106bfe8fa11c080fc90ba4354a0791e47f9a2 Mon Sep 17 00:00:00 2001 From: Joshua Daniel Pratt Nielsen Date: Sat, 20 Apr 2024 01:32:55 +0200 Subject: [PATCH 1/2] Fix logic for retrieving lastKnownElement --- .../forms/umbfocuslock.directive.js | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js index 69c11a11cc..3d412d34e1 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js @@ -88,26 +88,27 @@ // If an infinite editor is being closed then we reset the focus to the element that triggered the the overlay if(closingEditor){ - // If there is only one editor open, search for the "editor-info" inside it and set focus on it // This is relevant when a property editor has been selected and the editor where we selected it from // is closed taking us back to the first layer // Otherwise set it to the last element in the lastKnownFocusedElements array - if(infiniteEditors && infiniteEditors.length === 1){ - var editorInfo = infiniteEditors[0].querySelector('.editor-info'); - if(infiniteEditors && infiniteEditors.length === 1 && editorInfo !== null) { - lastKnownElement = editorInfo; - // Clear the array - clearLastKnownFocusedElements(); - } + var editorInfo = (infiniteEditors && infiniteEditors.length === 1) + ? infiniteEditors[0].querySelector('.editor-info') + : null; + + if(editorInfo !== null){ + lastKnownElement = editorInfo; + + // Clear the array + clearLastKnownFocusedElements(); } - else { - var lastItemIndex = $rootScope.lastKnownFocusableElements.length - 1; - lastKnownElement = $rootScope.lastKnownFocusableElements[lastItemIndex]; + else{ + var lastIndex = $rootScope.lastKnownFocusableElements.length - 1; + lastKnownElement = $rootScope.lastKnownFocusableElements[lastIndex]; - // Remove the last item from the array so we always set the correct lastKnowFocus for each layer - $rootScope.lastKnownFocusableElements.splice(lastItemIndex, 1); + // Remove the last item from the array so we always set the correct lastKnowFocus for each layer + $rootScope.lastKnownFocusableElements.splice(lastIndex, 1); } // Update the lastknowelement variable here From 5795cf119a0b5ab148019ed39d92ecbc5bd7b14c Mon Sep 17 00:00:00 2001 From: Johan Runsten Date: Fri, 12 Apr 2024 23:37:19 +0200 Subject: [PATCH 2/2] Typo when getting query parm --- .../src/components/external-login-provider.element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Login/src/components/external-login-provider.element.ts b/src/Umbraco.Web.UI.Login/src/components/external-login-provider.element.ts index b48943e019..0729f97027 100644 --- a/src/Umbraco.Web.UI.Login/src/components/external-login-provider.element.ts +++ b/src/Umbraco.Web.UI.Login/src/components/external-login-provider.element.ts @@ -73,7 +73,7 @@ export class UmbExternalLoginProviderElement extends LitElement { @property({attribute: 'external-login-url'}) set externalLoginUrl(value: string) { const tempUrl = new URL(value, window.location.origin); - const searchParams = new URLSearchParams(tempUrl.search); + const searchParams = new URLSearchParams(window.location.search); tempUrl.searchParams.append('redirectUrl', decodeURIComponent(searchParams.get('returnPath') ?? '')); this.#externalLoginUrl = tempUrl.pathname + tempUrl.search; }