Skip to content

Commit 77272be

Browse files
authored
Merge pull request #2384 from Squidly271/inhibitGUIsearch
Fix: Prevent GUI search if a modal is open
2 parents 5a22248 + c4d7bc0 commit 77272be

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

emhttp/plugins/dynamix.gui.search/gui_search.page

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ function guiSearchBoxSpan() {
3737
function setupGUIsearch() {
3838
window.addEventListener('keydown',function(e){
3939
if (!e.shiftKey && !e.altKey && (navigator.appVersion.indexOf('Mac')==-1 ? e.ctrlKey : e.metaKey) && e.keyCode==75) {
40+
// If a modal is visible, don't open the search box
41+
if ($('[role="modal"]').is(':visible')) return;
42+
4043
e.preventDefault();
4144
<?if ($themeHelper->isTopNavTheme()):?>
4245
if (guiSearchBoxSpan()) closeSearchBox(e); else gui_search();
@@ -79,6 +82,9 @@ function closeSearchBox(e) {
7982
}
8083

8184
function guiSearch() {
85+
// If a modal is visible, don't navigate away from the page
86+
if ($('[role="modal"]').is(':visible')) return;
87+
8288
var searchInfo = $('#guiSearchBox').val().split('**');
8389
var separator = ('fragmentDirective' in document) ? '#:~:text=' : '#';
8490
var scrollText = (typeof searchInfo[1] != 'undefined') ? separator+searchInfo[1].replace(' ','%20').replace('-','%2d') : '';

0 commit comments

Comments
 (0)