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

Fix bug in events.js #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

clairefro
Copy link

Current boiler runs all the exercise code blocks on page load, giving away the point of the exercise.

Instead, commented out the code blocks be default so students can see the effect of adding event listeners

@clairefro
Copy link
Author

clairefro commented Feb 7, 2024

One more important fix - the old boiler code suggested selecting the fourth div card and adding a keydown and keyup event, however keyboard events only work on input, textarea etc elements then bubble up to the document. The event does not fire when the listener is placed on the div.

https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event

image

So instead, in the last commit, I suggested removing the part where you save the fourth card to a variable, and instead have students just add an event listener to the document in order for the event to fire properly

ex:

document.addEventListener('keydown', function() {
    // do something cool
})
``

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