WebHelp's template includes a file called main.js. Among other things, it handles clicks on the sidebar TOC. If a TOC entry's link contains an HTML anchor, and the anchor's name contains a dot (.), and the anchor is on a HTML page that is not the one already displayed, clicking it will cause the sidebar to vanish since javascript execution ends unexpectedly.
If the link that was clicked is an HTML Anchor on the same page, everything works fine.
The code location is main.js, starting at line 82:
var hash = window.location.hash;
if(hash){
var targetOffset = $(hash).offset().top - 120;
$('html,body').animate({scrollTop: targetOffset}, 200);
return false;
}
Specifically, the problem is how JQuery's $(...) function is used: It expects CSS selectors instead of pure HTML anchors. Therefore, dots are assigned a special meaning. Here, however, we do not have a CSS selector, but just a plain anchor.
Suggested solution:
Don't feed the HTML anchors straight into JQuery's $(...) function. Instead, use document.getElementById(...) and feed the resulting element into $(...). The corrected code could look as follows:
if(hash){
if (hash.startsWith("#")){
hash = hash.substring(1);
}
var anchorElement = document.getElementById(hash);
var targetOffset = $(anchorElement).offset().top - 120;
$('html,body').animate({scrollTop: targetOffset}, 200);
return false;
}
Note
The same problem was described by Mary Tabasko on the [docbook-apps] mailing list in her eMail "Webhelp: My adventures therein" on 2014-09-09, 02:45 under the heading "Issues with links to local (within-page) IDs."
This applies to DocBook XSL 1.79.1