Skip to content

Commit

Permalink
DP-19866: Scroll issue fix (#1174)
Browse files Browse the repository at this point in the history
* DP-19866: Scroll issue fix

* DP-19866: Scroll to menu for desktop
  • Loading branch information
arthurbaghdas authored Sep 16, 2020
1 parent 76f865c commit f3f6a40
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ function closeMenu() {
function commonCloseMenuTasks() {
body.classList.remove("show-menu");

if (document.querySelector('html.stickyTOCtmp')) {
document.querySelector('html.stickyTOCtmp').classList.add('stickyTOC');
document.querySelector('html.stickyTOCtmp').classList.remove('stickyTOCtmp');
}
menuButton.setAttribute("aria-expanded", "false");
menuButton.setAttribute("aria-label", "Open the main menu for mass.gov");

Expand All @@ -516,7 +520,7 @@ function openMenu() {
commonOpenMenuTasks();
menuButton.setAttribute("aria-pressed", "true");
let alertsInterface = document.querySelector('.ma__emergency-alerts__interface');
if (document.querySelector("body").clientWidth < 841 && alertsInterface !== null) {
if (alertsInterface !== null) {
let emergencyAlerts = document.querySelector(".ma__emergency-alerts");
let scrollOffset = emergencyAlerts.offsetHeight - (alertsInterface.offsetHeight/1.5);

Expand Down Expand Up @@ -561,6 +565,11 @@ function openMenu() {
function commonOpenMenuTasks() {
body.classList.add("show-menu");

if (document.querySelector('html.stickyTOC')) {
document.querySelector('html.stickyTOC').classList.add('stickyTOCtmp');
document.querySelector('html.stickyTOC').classList.remove('stickyTOC');
}

menuButton.setAttribute("aria-expanded", "true");
menuButton.setAttribute("aria-label", "Close the main menu for mass.gov");
if (feedbackButton) {
Expand Down

0 comments on commit f3f6a40

Please sign in to comment.