Skip to content
Snippets Groups Projects
Commit 0590f746 authored by Torben Hansen's avatar Torben Hansen Committed by Christian Kuhn
Browse files

[BUGFIX] Fix JavaScript error in configuration module

When performing a search in the configuration module,
a JavaScript error will occur, if a possible expanded
tree node is not part of the search result.

This patch adds checks for existence of the scrollElement
variable.

Resolves: #96097
Releases: master, 11.5
Change-Id: I5977dd48487563ae30407f8cf126724acc9bcb0a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72320


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 21a38e79
No related merge requests found
......@@ -37,13 +37,15 @@ class ConfigurationView {
// scroll page down, so the just opened subtree is visible after reload and not hidden by doc header
// Determine scrollTo position, either first ".active" (search) or latest clicked element
let scrollElement = document.querySelector(self.location.hash);
if(document.querySelector('.list-tree .active ')) {
if (document.querySelector('.list-tree .active ')) {
scrollElement = document.querySelector('.list-tree .active ');
} else {
document.querySelector(self.location.hash).parentElement.parentElement.classList.add('active');
} else if (scrollElement) {
scrollElement.parentElement.parentElement.classList.add('active');
}
scrollElement.scrollIntoView({ block: 'center' });
if (scrollElement) {
scrollElement.scrollIntoView({ block: 'center' });
}
}
}
}
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","TYPO3/CMS/Core/DocumentService","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,r,s){"use strict";return new class{constructor(){if(this.searchForm=document.querySelector("#ConfigurationView"),this.searchField=this.searchForm.querySelector('input[name="searchString"]'),this.searchResultShown=""!==this.searchField.value,r.ready().then(()=>{new s("search",()=>{""===this.searchField.value&&this.searchResultShown&&this.searchForm.submit()}).bindTo(this.searchField)}),self.location.hash){let e=document.querySelector(self.location.hash);document.querySelector(".list-tree .active ")?e=document.querySelector(".list-tree .active "):document.querySelector(self.location.hash).parentElement.parentElement.classList.add("active"),e.scrollIntoView({block:"center"})}}}}));
\ No newline at end of file
define(["require","exports","TYPO3/CMS/Core/DocumentService","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,r,s){"use strict";return new class{constructor(){if(this.searchForm=document.querySelector("#ConfigurationView"),this.searchField=this.searchForm.querySelector('input[name="searchString"]'),this.searchResultShown=""!==this.searchField.value,r.ready().then(()=>{new s("search",()=>{""===this.searchField.value&&this.searchResultShown&&this.searchForm.submit()}).bindTo(this.searchField)}),self.location.hash){let e=document.querySelector(self.location.hash);document.querySelector(".list-tree .active ")?e=document.querySelector(".list-tree .active "):e&&e.parentElement.parentElement.classList.add("active"),e&&e.scrollIntoView({block:"center"})}}}}));
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment