Journal / Web App and Frontend Development

Web App and Frontend Development

Drag and Drop in Modern Web Apps

Drag and drop in modern web apps lets users move items between locations using their mouse or touch. The basic browser API exists. The library ecosystem in React has matured to dnd-kit as the dominant choice. The right implementation handles keyboard accessibility, touch devices, virtual lists, multi item selection, and the inevitable optimistic update with server confirmation. The wrong implementation works in the demo and breaks for real users.

What you actually need to know

  • dnd-kit is the default React library in 2026.
  • Keyboard accessibility is required, not optional.
  • Touch device support requires testing on real devices.
  • Optimistic update with server confirmation is the right pattern.
  • Test multi item, keyboard, touch, and virtualized cases before ship.

Case

Test before ship

Single item drag

Yes

Multi item drag

Yes

Keyboard pickup and move

Yes

Touch on mobile

Yes

Drag across long list

Yes

Drag with virtualization

Yes

Drop on invalid target

Yes

Server error during drop

Yes

The core argument

Drag and drop is one of those features that founders treat as simple because the demo works. The team installs the library. The example works. The team ships. The customer uses it on their iPad. The drag interferes with scrolling. The customer uses keyboard navigation. The drag is unreachable. The customer drops an item and the server fails. The item snaps back without explanation. The feature feels broken.

The fix is to recognize that drag and drop has many edge cases that the demo does not exercise. Multi item selection. Keyboard pickup. Touch on tablets. Virtualized long lists. Drop on invalid targets. Server errors during the drop. Each edge case has a correct behavior. The team has to design for all of them before shipping.

The library ecosystem has matured. dnd-kit is the dominant React library in 2026. The API is composable. Accessibility is built in. Performance is good. The team can rely on the library to handle the basics. The team is still responsible for the application specific decisions.

The discipline that pays off is testing the edges. The demo is the easy case. The production deployment is the long tail of real user scenarios. The team that tests the edges ships a feature that works for real users. The team that ships the demo ships a feature that customers complain about for a year.

The edge cases worth testing

Edge case

What to verify

Single item drag with mouse

Basic happy path works

Multi item drag

Selection persists, items move together

Keyboard pickup with Tab, Space, Enter

All keyboard users can drag

Touch on mobile and tablet

Pickup, move, drop all work cleanly

Drag during scroll

Drag does not interfere with scrolling

Long list with virtualization

Items off screen do not break

Drop on invalid target

Item snaps back cleanly with feedback

Server error during drop

Optimistic update rolls back gracefully

Two users dragging the same item

Conflict resolution is deterministic

Network slow during drop

Loading state is visible

How much does this cost

The library is free. The integration is roughly a sprint for a meaningful drag and drop surface. The testing of edges is days. The total investment for a feature that works is roughly two sprints. The investment for a feature that works only in the demo is days but the cost shows up in customer complaints.

Features the drag and drop must have

  • A library that handles keyboard, touch, and mouse.
  • Accessibility configured with announcements.
  • Optimistic UI update with server confirmation.
  • Rollback on server error.
  • Clear visual feedback during drag.
  • Snap back behavior on invalid drops.
  • Multi item selection where applicable.
  • Tested on real touch devices.
  • Tested with keyboard only navigation.

Expert opinion

Drag and drop is the kind of feature where the gap between the demo and production is enormous. The teams that test the edges ship features customers love. The teams that ship the demo ship features customers complain about. The investment in testing is small. The customer experience difference is large.

Yashveer Singh, founder of Yashveer Labs

How this played out on a real project

A client had shipped a kanban board with drag and drop. The desktop experience was fine. The mobile experience was broken. iPad users could not drag without triggering scroll. Keyboard users could not move cards at all.

We rebuilt with dnd-kit. Proper pointer handling for touch. Keyboard sensors for accessibility. Announcements for screen readers. Optimistic updates with server confirmation.

The mobile experience became usable. Keyboard users could navigate the board. The screen reader experience was acceptable. The customer satisfaction on the feature improved measurably within a month. The investment was three weeks. The customer complaints stopped.

For more on the related work, see building forms that customers love and component libraries vs custom design systems.

Common mistakes teams make

  1. Shipping without testing on touch devices.
  2. No keyboard accessibility. Excludes users.
  3. No optimistic update. Drag feels laggy.
  4. No rollback on server error. Items disappear mysteriously.
  5. No visual feedback during drag.
  6. Native HTML5 API for anything beyond simple.
  7. No test of virtualized lists.
  8. No conflict handling for concurrent updates.

A two week implementation plan

  1. Week one. Integrate dnd-kit. Build the basic drag and drop.
  2. Week two. Add keyboard, touch, accessibility, optimistic update, rollback. Test edges.

For more on the related work, read building forms that customers love and the patterns that make a SaaS feel premium. On the broader frontend side, building cinematic web experiences without killing performance is the natural next read.

FAQ

Frequently asked

  • What library should I use in 2026?
  • What about the native HTML drag and drop API?
  • How do I handle accessibility?
  • What about touch devices?
  • How do I optimistically update on drop?
  • What about virtual lists?
  • What is the most common drag and drop mistake?

Author

A note from Yashveer Singh

This was written by me, Yashveer Singh. The reason I write at this length and this depth is that the alternative is generic SEO content, and I am not interested in being one more of those. If you found this post useful, that is by design. If you want to talk about the project you are facing, the work happens through one channel: send a message via Instagram, and I will get back to you with a real answer, not a templated reply.

Start the conversation See the work DM on Instagram