Skip to content

Commit

Permalink
Fix #1134 - TOC dialog scrolls to current page when opened
Browse files Browse the repository at this point in the history
  • Loading branch information
FayCross authored and torinfo committed Jul 15, 2022
1 parent 32ec2d3 commit c3d127c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Expand Up @@ -2488,7 +2488,6 @@ function x_changePageStep6() {
if (x_pageInfo[x_currentPage].built != false) {
x_doDeepLink();
}

}

function x_focusPageContents(firstLoad) {
Expand Down Expand Up @@ -3108,6 +3107,10 @@ function x_openDialog(type, title, close, position, load, onclose) {
{
$x_popupDialog.load(x_templateLocation + "models_html5/" + type + ".html", function () {
x_setDialogSize($x_popupDialog, position);

if (type == "menu") {
menu.showCurrent();
}
});
}

Expand Down
10 changes: 3 additions & 7 deletions modules/xerte/parent_templates/Nottingham/models_html5/menu.html
Expand Up @@ -112,7 +112,6 @@

} else { // menu is in dialog
$("#menuHolder").removeClass("splitScreen");
this.showCurrent();
}

$("#screenReaderInfo").html(x_getLangInfo(x_languageData.find("toc")[0], "htmlDescription", "Use the tab key to select a page. Press space to go to that page."));
Expand All @@ -129,12 +128,9 @@
// function called from xenith every time menu in popup appears - highlights current page in list and pages visited
this.showCurrent = function() {
$("#menuItems").find(".current").removeClass("current");
var $thisItem = $("#menuItems .menuItem:eq(" + x_normalPages.indexOf(x_currentPage) + ")")
.addClass("current")
.focus();
if ($thisItem.position().top != $thisItem.parents("#x_menu").scrollTop()) {
$thisItem.parents("#x_menu").scrollTop($thisItem.position().top - parseInt($thisItem.css("margin-bottom")));
}
$("#menuItems .menuItem:eq(" + x_normalPages.indexOf(x_currentPage) + ")")
.addClass("current")
.focus();

if (x_params.pageTick == undefined || x_params.pageTick == "true") {
$("#menuItems .menuItem").each(function(i) {
Expand Down

0 comments on commit c3d127c

Please sign in to comment.