Input
User types '1', '2', '3', '4'
Output
complete event fires with detail.pin = '1234'
Each digit entry advances focus to the next box. After the 4th digit, the complete event fires.
Build a 4-digit PIN entry component inside the existing app container. It must behave like a real PIN pad: each box accepts exactly one digit, focus moves automatically between boxes as the user types and deletes, and t...
index.htmlEditable startermain.jsEditable starterUser types '1', '2', '3', '4'
complete event fires with detail.pin = '1234'
Each digit entry advances focus to the next box. After the 4th digit, the complete event fires.
User types '1', then 'a', then '2'
Inputs show '1', '', '2', '' — focus is on index 2
'a' is not a digit — it is ignored. Focus does not advance on a rejected keypress.
This component manages 4 independent DOM nodes. How would you structure this if the number of digits was configurable via a `data-length` attribute on the container?