Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile view burger Icon to show menu is not working sometimes #1963

Closed
1 task done
koppor opened this issue Sep 24, 2024 · 4 comments · Fixed by #1964
Closed
1 task done

Mobile view burger Icon to show menu is not working sometimes #1963

koppor opened this issue Sep 24, 2024 · 4 comments · Fixed by #1964
Labels
released Included or resolved in the release

Comments

@koppor
Copy link

koppor commented Sep 24, 2024

Checklist

How did you create the site?

Generated from chirpy-starter

Describe the bug

Click on mobile burger does not do anything:

image

Uncaught TypeError: document.getElementById(...) is null
    <anonymous> https://blog.jabref.org/assets/js/dist/post.min.js:4
    <anonymous> https://blog.jabref.org/assets/js/dist/post.min.js:4

image

Steps To Reproduce

  1. Open https://blog.jabref.org/2024/09/18/JabCon24/
  2. Shrink browser size
  3. Click on burger menu

Expected Behavior

Burger menu opens

Environment

Anything else?

Follow-up to #1025

@cotes2020
Copy link
Owner

Hi,

Steps To Reproduce

  1. Open https://blog.jabref.org/2024/09/18/JabCon24/
    ...

Can you provide the steps to reproduce the error using the code in this repository?

@koppor
Copy link
Author

koppor commented Sep 26, 2024

Hi,

Steps To Reproduce

  1. Open https://blog.jabref.org/2024/09/18/JabCon24/
    ...

Can you provide the steps to reproduce the error using the code in this repository?

This will take some hours. I will try!

@subhramit
Copy link

subhramit commented Sep 30, 2024

Can you provide the steps to reproduce the error using the code in this repository?

Hi Cotes, I am a JabRef developer. I managed to pinpoint the issue to the toc configuration and made minimum working examples:
Buggy: https://github.com/subhramit/chirpy-mwe-buggy
Non-buggy: https://github.com/subhramit/chirpy-mwe-ok

Difference:

The page must have a "##" heading tag:

image

Now, if the following toc config flag in _config.yml is set to true, then there is no issue:

# boolean type, the global switch for TOC in posts.
toc: true

However, when it is set to false, the hamburger menu doesn't work.
It is as if the presence of toc is required for the hamburger menu to work, which is a strange association:

image

More details:
On the buggy pages, when the page opens, we observe the following error on inspecting:
image
Which comes from the part marked "2" in the following code from post.min.js:
image

Part "1" bugs out when we click the hamburger menu (as described in the issue description).

It is as if the following section (in post.min.js) is trying to initialize the headings into a toc element that does not exist (in the buggy version with toc flag set to false):

document.querySelector("main h2, main h3") && (tocbot.init({
    tocSelector: "#toc",
    contentSelector: ".content",
    ignoreSelector: "[data-toc-skip]",
    headingSelector: "h2, h3, h4",
    orderedList: !1,
    scrollSmooth: !1
}),
document.getElementById("toc-wrapper").classList.remove("d-none"))

I hope this helps!

Copy link

🎉 This issue has been resolved in version 7.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Included or resolved in the release label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Included or resolved in the release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants