-
-
Notifications
You must be signed in to change notification settings - Fork 137
Open
Labels
💻 aspect: codeConcerns the software code in the repositoryConcerns the software code in the repository🚧 status: blockedBlocked & therefore, not ready for workBlocked & therefore, not ready for work🛠 goal: fixBug fixBug fix🟩 priority: lowLow priority and doesn't need to be rushedLow priority and doesn't need to be rushed
Description
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
- Open the webpage.
- Right-click and select Inspect (or press Ctrl+Shift+I / Cmd+Option+I on Mac).
- Open the console.
- See error.
Expectation
The application should handle the absence of the menuButton and menuPanel elements gracefully without throwing an error.
Screenshots
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
💻 aspect: codeConcerns the software code in the repositoryConcerns the software code in the repository🚧 status: blockedBlocked & therefore, not ready for workBlocked & therefore, not ready for work🛠 goal: fixBug fixBug fix🟩 priority: lowLow priority and doesn't need to be rushedLow priority and doesn't need to be rushed
Type
Projects
Status
Backlog