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

[Bug] Uncaught TypeError in vocabulary.js due to Missing menuButton and menuPanel Elements . #345

Open
1 task done
SumaiyaaRq opened this issue Oct 31, 2024 · 2 comments
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟩 priority: low Low priority and doesn't need to be rushed 🚧 status: blocked Blocked & therefore, not ready for work

Comments

@SumaiyaaRq
Copy link
Contributor

Description

I've noticed an issue in vocabulary.js where the code attempts to add an event listener to menuButton and toggle a class on menuPanel, but these elements are not present in the HTML file. This results in an Uncaught TypeError due to trying to call addEventListener on null.

Reproduction

  1. Open the webpage.
  2. Right-click and select Inspect (or press Ctrl+Shift+I / Cmd+Option+I on Mac).
  3. Open the console.
  4. See error.

Expectation

The application should handle the absence of the menuButton and menuPanel elements gracefully without throwing an error.

Screenshots

Screenshot 2024-11-01 at 12 22 37 AM

Suggested Fix:

Adding checks to see if menuButton and menuPanel exist before using them.

Environment

  • OS: (macOS)
  • Browser: (Chrome)

Additional context

If the menuButton and menuPanel elements aren't needed because the menu functionality is not being used, the best approach might be to:

  • Remove the Code: If the menu functionality is entirely unnecessary, the cleanest solution is to remove the related code. This avoids unnecessary checks and potential errors.
  • Use Conditional Code: If the menu might be added in the future or conditionally in specific layouts, you can leave the code with null checks to ensure it only runs when the elements are present.

Resolution

  • I would be interested in resolving this bug.
@SumaiyaaRq SumaiyaaRq added 💻 aspect: code Concerns the software code in the repository 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents labels Oct 31, 2024
@possumbilities possumbilities added 🟩 priority: low Low priority and doesn't need to be rushed 🚧 status: blocked Blocked & therefore, not ready for work and removed 🟧 priority: high Stalls work on the project or its dependents 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Nov 1, 2024
@possumbilities
Copy link
Contributor

possumbilities commented Nov 1, 2024

The newer versions of Vocabulary do null checks here, so this should be corrected as soon as the repository is updated to the latest Vocabulary. Moving to 🚧 status: blocked Blocked & therefore, not ready for work until then

@SumaiyaaRq
Copy link
Contributor Author

@possumbilities Thank you for confirming! I had a sense that the latest versions of Vocabulary included null checks, so it’s good to know this will be addressed when the repository is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟩 priority: low Low priority and doesn't need to be rushed 🚧 status: blocked Blocked & therefore, not ready for work
Projects
Status: Backlog
Development

No branches or pull requests

2 participants