Help browser fixes
I'm afraid that the description of this MR is way longer than the diff. :) But the TL;DR is that this resolves two long-standing (4-5 years old) bugs in the help browser, (1) navigation with the Tab key not working, and (2) searching for stuff with the browser findbox not working for mixed case. Details below (which is just a formatted summary of the commit messages).
Fix broken keyboard navigation in the help browser.
While it is just one little missing check in the keyboard event handler, which is surely just an oversight, this has the dire consequence of breaking navigation with the Tab key.
-
The root cause for this issue is in the document.body event listener callback at line 749 in the current dialog_search.html source, where we always reset the focus to the search text input if there's any keyboard input (other than a LF or CR on the file browser and bookmark buttons) while the focus is on something else (such as an item in the toc or in the search results). The intention there surely was to enable the user to just start typing anywhere in the dialog, which is convenient, but breaks Tab navigation as an ill side-effect.
-
The fix is simply to not reset the focus if the key event is the Tab key. By these means, you can still start typing your search terms from anywhere in the dialog, but navigation with Tab and Shift+Tab now works as expected, too.
-
Also, why is the div holding the toc items created again and again for each item in display_toc()? I moved the corresponding statement,
div = document.createElement("div")
, right before thetoc.forEach()
loop now, which I think is where it really belongs.
Fix case-sensitive search in the browser's findbox.
This uses findAndReplaceDOMText(), which apparently looks for case-sensitive matches, but the search text entered by the user is always converted to lowercase. This means that mixed case search terms just won't be found, which is bad. (E.g., try searching for "GEM" in the toc to see this bug in action.)
Fixed by just removing the call to toLowerCase()
on the search text, case-sensitive searches now work as expected, problem solved.