summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-03-22 14:04:00 (GMT)
committerGitHub <noreply@github.com>2020-03-22 14:04:00 (GMT)
commit5f192d9830bc32022b64715ad441b3c09438d8ff (patch)
tree22181a9ebfc58e66de9ddcae9921fefdab7728ca
parent386bc490c931392778334772eee6a56778cd5ae1 (diff)
parent2f66c80e7d59f2dd22036b17e77a48e547705d96 (diff)
downloadDoxygen-5f192d9830bc32022b64715ad441b3c09438d8ff.zip
Doxygen-5f192d9830bc32022b64715ad441b3c09438d8ff.tar.gz
Doxygen-5f192d9830bc32022b64715ad441b3c09438d8ff.tar.bz2
Merge pull request #7659 from jmirabel/fix_cros_issue
Fix CROS javascript issue when giving focus to search result frame.
-rw-r--r--src/searchindex.cpp6
-rw-r--r--templates/html/htmlsearchresult.tpl6
-rw-r--r--templates/html/search.js5
3 files changed, 14 insertions, 3 deletions
diff --git a/src/searchindex.cpp b/src/searchindex.cpp
index 0296b93..0e3ef44 100644
--- a/src/searchindex.cpp
+++ b/src/searchindex.cpp
@@ -1007,6 +1007,12 @@ void writeJavaScriptSearchIndex()
t << "document.getElementById(\"NoMatches\").style.display=\"none\";" << endl;
t << "var searchResults = new SearchResults(\"searchResults\");" << endl;
t << "searchResults.Search();" << endl;
+ t << "window.addEventListener(\"message\", function(event) {" << endl;
+ t << " if (event.data == \"take_focus\") {" << endl;
+ t << " var elem = searchResults.NavNext(0);" << endl;
+ t << " if (elem) elem.focus();" << endl;
+ t << " }" << endl;
+ t << "});" << endl;
t << "/* @license-end */\n";
t << "--></script>" << endl;
t << "</div>" << endl; // SRIndex
diff --git a/templates/html/htmlsearchresult.tpl b/templates/html/htmlsearchresult.tpl
index db37a5d..4e15414 100644
--- a/templates/html/htmlsearchresult.tpl
+++ b/templates/html/htmlsearchresult.tpl
@@ -24,6 +24,12 @@ document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
+window.addEventListener("message", function(event) {
+ if (event.data == "take_focus") {
+ var elem = searchResults.NavNext(0);
+ if (elem) elem.focus();
+ }
+});
/* @license-end */
--></script>
</div>
diff --git a/templates/html/search.js b/templates/html/search.js
index a554ab9..86fbb9c 100644
--- a/templates/html/search.js
+++ b/templates/html/search.js
@@ -200,10 +200,9 @@ function SearchBox(name, resultsPath, inFrame, label)
}
return;
}
- else if (window.frames.MSearchResults.searchResults)
+ else
{
- var elem = window.frames.MSearchResults.searchResults.NavNext(0);
- if (elem) elem.focus();
+ window.frames.MSearchResults.postMessage("take_focus", "*");
}
}
else if (e.keyCode==27) // Escape out of the search field