Skip to content

Fix page-load TypeError from removed #db-setup-open element#48

Open
Jada-Q wants to merge 1 commit into
hasaneyldrm:mainfrom
Jada-Q:fix-db-setup-typeerror
Open

Fix page-load TypeError from removed #db-setup-open element#48
Jada-Q wants to merge 1 commit into
hasaneyldrm:mainfrom
Jada-Q:fix-db-setup-typeerror

Conversation

@Jada-Q

@Jada-Q Jada-Q commented Jul 13, 2026

Copy link
Copy Markdown

Summary

index.html throws a TypeError: Cannot read properties of null (reading 'addEventListener') on every page load.

The header DB Setup button was changed at some point to a direct link to setup.html, but the modal wiring still does dbOpenBtn.addEventListener(...) on the removed #db-setup-open element. Because the error is thrown mid-wiring, the listeners registered after it (modal close button, ESC key, DB tab switching, copy, generate SQL) are silently skipped as well.

This change guards the missing trigger with a null check, so the remaining listeners register and the console stays clean.

Validation

  • Before: loading index.html logs the TypeError at the dbOpenBtn.addEventListener line (reproduced on current main)
  • After: page loads with no console errors; all 1,324 exercises render (verified in Chromium via Playwright)

🤖 Generated with Claude Code

The header DB Setup button was changed to a direct link to setup.html,
but the modal wiring still calls addEventListener on the removed
#db-setup-open element. The resulting TypeError on every page load also
prevents the listeners after it (close button, ESC key, tab switching,
copy, generate SQL) from being registered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant