Hi Jacob, thanks for your educational example.
FYI–d3 v6 and up have replace the global d3.event with a local event passed to all the listeners.
To migrate:
* remove require("https://d3js.org/d3.v5.min.js") (lazy import by default)
* have dragged(event, d, i) use just event rather than d3.event