InternationalScratchWiki / ScratchWikiSkin2

Skin for the Scratch Wiki.
https://en.scratch-wiki.info
MIT License
17 stars 15 forks source link

Hamburger menu not working on mobile #130

Closed jacob-g closed 8 months ago

jacob-g commented 8 months ago

Reported by ahmetlii

Steps to reproduce:

  1. Open the Wiki on a mobile browser (I used Firefox Android)
  2. Click the hamburger menu at the top left

Expected behavior: sidebar opens Actual behavior: sidebar does not open (nothing happens)

Kenny2github commented 8 months ago

Cannot reproduce on Chrome mobile so this seems to be browser-specific.

jacob-g commented 8 months ago

I am getting the following console error:

Uncaught TypeError: sidebarToggle.computedStyleMap is not a function

Relevant code:

var sidebarToggle = document.querySelector('#navigation .sidebar-toggle')
sidebarToggle.addEventListener('click', function(){
    if (sidebarToggle.computedStyleMap().get('display').value === 'none') return; // this is the line that fails
    if (!sidebarShown) {
        document.querySelector('#view .inner .left').style.left = '0';
    } else {
        document.querySelector('#view .inner .left').style.left = null;
    }
    sidebarShown = !sidebarShown;
});
jacob-g commented 8 months ago

From MDN: https://developer.mozilla.org/en-US/docs/Web/API/Element/computedStyleMap computedStyleMap is not compatible with Firefox