Track 02 · Lesson 2 of 17Inside the browser
- 01Events and bubbling
- 02What fires when you click or type
- 03Keyboard, input and focus events
- 04Default actions and preventDefault()
- 05Event delegation
- 06Listener options and cleanup
- 07Custom events
- 08Debounce and throttle
- 09Events in React
- 10The event loop
- 11Don't block the main thread
- 12The rendering pipeline
- 13Core Web Vitals
- 14HTTP caching
- 15Responsive design
- 16SEO basics
- 17Service workers and offline
What fires when you click or type
Lesson 2 of 17· 7 min
One click is not one event. The browser fires a whole sequence, and every event carries an object full of details. Use the controls and watch the log; click any log row to inspect its event object.
Record everything
Click, type, tick, pick
Everything in this box is being listened to
Event log, oldest first (click a row)
Interact with the controls on the left.
The selected event object
Click a row in the log.
For one mouse click: pointerdown → mousedown → focus → pointerup → mouseup → click. For one keystroke in a text field: keydown → beforeinput → input → keyup. Touch screens fire pointer events too.
Pick the event that matches your intent#
The browser fires low-level events (pointerdown, keydown) and higher-level ones (click, input, submit). Reach for the high-level one whenever it fits:
clickfor activating something. It also fires when a keyboard user presses Enter or Space on a button, so it keeps your page usable without a mouse.inputfor reacting to typing as it happens.submitfor forms, rather than a click on the submit button. Pressing Enter in a field submits the form too, and onlysubmitcatches both.- Pointer events (
pointerdown,pointermove) when you need the low-level detail. They cover mouse, pen and touch with one listener.
What's inside an event object#
Every event has type, target, currentTarget, timeStamp and isTrusted. Keyboard events add key and code; pointer events add coordinates and pointerType. isTrusted is false for events your own code dispatches, which is how a page can tell a real click from a fake one.
Check yourself