Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

I Built a Drag-and-Drop Kanban Board with Vanilla JavaScript

If you've ever wanted to understand how drag-and-drop actually works under the hood — no libraries, no frameworks, just the browser — building a Kanban board is a great way to find out. Here's how I built one using plain HTML, CSS, and JavaScript. The Idea A Kanban board is one of those projects that looks simple on the surface but forces you to actually understand the DOM: creating elements,…

Creating a drag-and-drop Kanban board with just plain HTML, CSS, and JavaScript is a fantastic way to gain a deeper understanding of how the browser's native Drag and Drop API actually functions. In this project, we end up with three columns — To Do, In Progress, and Done — where cards can be moved easily between them. The structure is simple, featuring a `.board` container containing three `.list` columns.

Each column is associated with a heading and a few `.card` elements that have the `draggable="true"` attribute, unlocking the HTML5 Drag and Drop API.

The core functionality relies on several key events tied to both the cards and the lists. For each card, we listen for the `dragstart` and `dragend` events. When a drag begins, the card's ID is stored in the `dataTransfer` object. This single piece of data serves as our state, as all other information can be retrieved from the DOM.

On each list, we handle the `dragover`, `dragenter`, `dragleave`, and `drop` events. The `dragover` event is essential as it must call `preventDefault()`. This call is crucial because browsers block drops by default, and invoking `preventDefault()` tells the browser that the element accepts drops. Following this, the `dragDrop` function retrieves the card's ID from the `dataTransfer` object and appends it to the list using `appendChild()`.

This move is seamless, as the card is simply relocated to a new parent node without any cloning or re-rendering required.

To enhance the user experience, a subtle `.over` class is added, which activates during `dragenter` and `dragleave` events, giving the target list a faint highlight. This small detail makes the board feel more responsive. A further enhancement could be persistence, allowing the board state to be saved with `localStorage` so that cards persist between page refreshes.

Adding the ability to create, edit, and delete cards directly within the board could also be valuable. Finally, adding touch support could make the board more versatile for mobile users, although the native Drag and Drop API may require a fallback for optimal mobile compatibility.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Get better color accuracy on your TV with these simple steps

Even if it has impressive out-of-the-box color, your new (or old) TV can always benefit from a few simple tweaks to get the best color accuracy possible.

  • Adjust color temperature to achieve desired warmth or coolness.
  • Modify color saturation for balance between vibrancy and clarity.
  • Fine-tune red, green, and blue levels for precise color accuracy.

I Write Less Code Than I Used To. That May Be the Point.

Over the last year, my day-to-day job has changed in a way I am still trying to understand. I am still an engineer. I still design systems, read code, debug failures, review implementations, and…

  • Author now designs systems and reviews implementations, writing less code.
  • AI generates code implementations, but correctness requires engineering.
  • Author focuses on defining constraints, architecture, and failure taxonomies for AI systems.

Spotify App Adds a List of New Features

Spotify has added a whole bunch of new features for its app, including Playlist Notes, Running Mode, and more. Playlist … Read More The post Spotify App Adds a List of New Features appeared first on…

React Portals: How They Work and When to Use Them for Modals and Tooltips

You’ve probably built a modal or tooltip in React and hit a weird snag: the overlay appears visually outside your usual component tree, but events don’t behave as you expect.

  • React portals render children outside normal DOM tree position.
  • Portalized components like modals, tooltips benefit from divs outside root container.
  • Proper event handling and focus management required for portalized UI elements.

Building a Change & Alert Engine That Webhooks Any Diff on Any URL

Most data jobs re-pull the whole source every run and waste time and money on data that didn't move. A change-detection engine wakes up, checks what actually changed, and pushes only the diff.

  • Engine detects changes on any URL, sends only differences
  • Polls source once per schedule, auto-sniffs content format
  • Supports JSON, RSS/Atom, HTML; emits changes with before/after

More from Wednesday 19 August →