News for hackers. Stuff that matters.
Re:Declarative Dragging by gavinray on Sunday November 08, 2026 @04:51PM (#50417709)
Funny story about drag-and-drop:

At my very first job, we had a weekly meeting to assign tickets and estimates.

Our non-technical PM wrote "drag-and-drop" on a whiteboard, and then my name.

"Gavin, how long do you think this will take?"

"All week. At least. Maybe longer?"

PM laughed, then realized I wasn't making a joke.

"What do you mean 'all week'? That's ridiculous, do I need to give this to someone else?"

"Well, you could, but I wouldn't count on you getting it any sooner."

Appalled, he exclaims: "It's just drag-and-drop!"

After 10-15 minutes of a room full of engineers trying to explain the difficulty, he gave up with an unhappy "Fine."

The phrase "it's just drag-and-drop" became an inside joke for the rest of my time there...

Re:Declarative Dragging by timcobb on Sunday November 08, 2026 @05:21PM (#50418033)
good thing you had backup. rough hahaha.
Re:Declarative Dragging by freecodeio on Sunday November 08, 2026 @05:36PM (#50418183)
I think non-tech people think that drag and drop is some sort of emergent property because you're pressing the mouse and holding it pressed.
Re:Declarative Dragging by polarsanel on Monday November 09, 2026 @05:10AM (#50423557)
Making something easier and more intuitive for a human is more work as always.
Re:Declarative Dragging by adastra22 on Sunday November 08, 2026 @05:43PM (#50418270)
Dumb question: why? It’s been a long time since I touched GUI code, but I thought it gave you a message with the URI to the file. How is this significantly different than file-open?
Re:Declarative Dragging by mcculley on Sunday November 08, 2026 @05:50PM (#50418343)
There are more possible actions than opening files.
Re:Declarative Dragging by gavinray on Sunday November 08, 2026 @06:53PM (#50419063)
This was circa 2010 or so, and it was a web app. So pre-ES6 JavaScript, before React.

Nowadays you would just "npm install drag-and-drop" but back then you often had to hand-roll solutions.

If anyone can dig up an ancient library on GitHub for drag-and-drop back in those days, I'd imagine it would be several thousand lines long, not to mention the absolute nightmare that testing something like this with a proper framework and accompanying testing library.

Re:Declarative Dragging by adastra22 on Sunday November 08, 2026 @07:27PM (#50419359)
Ah, I was thinking desktop applications.
Re:Declarative Dragging by Xirdus on Monday November 09, 2026 @12:30AM (#50421427)
Desktop app drag and drop is also a nightmare. Various frameworks can make it easier or harder, but regardless of what you choose, you have about 5 different states your draggable is in, and all of these states have at least 2 transitions to other states, and all your drop targets have to handle mouse-in/mouse-out/drop-end events, and those events need to expose enough data about the dragged object so that every drop target can not only execute the drop, but also tell you whether dropping is allowed without consuming the data.

It's not insurmountable by any means, but it does have enormous inherent complexity compared to almost every other UI action there is.

Re:Declarative Dragging by DonHopkins on Tuesday November 10, 2026 @09:21AM (#50440796)
It's always been a nightmare.

https://donhopkins.medium.com/the-x-windows-disaster-128d398...

Myth: X Makes Unix “Easy to Use”

Graphical interfaces can only paper over misdesigns and kludges in the underlying operating system; they can’t eliminate them.

The “drag-and-drop” metaphor tries to cover up the Unix file system, but so little of Unix is designed for the desktop metaphor that it’s just one kludge on top of another with little holes and sharp edges popping up everywhere. Maybe the “sag-and-drop” metaphor is more appropriate for such ineffective and unreliable performance.

A shining example is Sun’s Open Windows File Manager, which goes out of its way to display core dump files as cute little red bomb icons. When you double-click on the bomb, it runs a text editor on the core dump. Harmless, but not very useful. But if you intuitively drag and drop the bomb on the DBX Debugger Tool, it does exactly what you’d expect if you were a terrorist: it ties the entire system up, as the core dump (including a huge unmapped gap of zeros) is pumped through the server and into the debugger text window, which inflates to the maximum capacity of swap space, then violently explodes, dumping an even bigger core file in place of your original one, filling up the entire file system, overwhelming the file server, and taking out the File Manager with shrapnel. (This bug has since been fixed.)

But that’s not all: the File Manager puts even more power at your fingertips if you run it as root! When you drag and drop a directory onto itself, it beeps and prints “rename: invalid argument” at the bottom of the window, then instantly deletes the entire directory tree without bothering to update the graphical directory browser.

Re:Declarative Dragging by anonymous908213 on Sunday November 08, 2026 @07:27PM (#50419361)
Hit-test where the mouse-down event is fired, hit-test where the mouse-up event is fired. What the hell do you need a library or a week for?

> If anyone can dig up an ancient library on GitHub for drag-and-drop back in those days, I'd imagine it would be several thousand lines long,

I bet, JS devs love overcomplicating and obfuscating simple concepts. Spaghetti artist might be a more accurate job title than web developer.

Re:Declarative Dragging by gavinray on Sunday November 08, 2026 @07:58PM (#50419606)

  > What the hell do you need a library for?
On the frontend, you have to re-calculate the display state for all the possible drop positions, in-between transitions, and drop-end-snap-back.

Think of a grid of cards, and all the possible drag, hover, and drop state transitions it can be in with any other card, and the animations required to make it look nice

Now also consider that you need to persist the final state on the backend, and handle things like rejection, cancellation, failed updates/errors.

It becomes a massive state chart and web of complexity

Re:Declarative Dragging by anonymous908213 on Sunday November 08, 2026 @08:21PM (#50419759)
I mean, maybe we're missing context here. Is that what your boss was actually asking for? 99.99% of web applications (or, hell, desktop applications) don't have ultra-interactive, fully-responsive-animation drag-and-drop. If he was asking for functional drag-and-drop and the team was implementing top 0.01% cosmetic drag-and-drop, that's certainly one avenue for a mismatch in expectations.
Re:Declarative Dragging by FearNotDaniel on Monday November 09, 2026 @05:21AM (#50423654)
I think people are talking about two different kinds of drag-and-drop. There is dragging external items (files from the OS, for example) onto the app surface from outside. And there is a list of items, each with its own UI component, being dragged within an app to either change sort order or otherwise change data state. Both complex, and have a lot in common, but many comments here seem to be talking about one or the other without specifying.
Re:Declarative Dragging by dofm on Sunday November 08, 2026 @10:03PM (#50420503)
What does that look like mid drag, and how?

If you are dragging within the paage, then the draggable “ghostl is your problem too. As is deciding whether the ghost should affirmatively snap out of and into the source and target containers (that is, whether the destination container should appear to “make room” for the ghost at some point), whether there’s a transition on that, etc.

Drag and drop in non-web GUIs have all sorts of visual affordances that are your job in HTML.

Re:Declarative Dragging by anonymous908213 on Sunday November 08, 2026 @10:12PM (#50420573)
> draggable ghost

Okay, you've added a requirement. Poll the current cursor position after the first hit-test sets the dragging state and call a function to render what you what rendered there at a higher Z level than anything else. Your 30 minute job has become a 60 minute job.

> As is deciding whether the ghost should affirmatively snap out of and into the source and target containers (that is, whether the destination container should appear to “make room” for the ghost at some point), whether there’s a transition on that,

Most applications don't go this far, including your operating system like Windows that sets baseline UX expectations, so you're well beyond the default expectation for drag-and-drop. If someone asks you to implement drag-and-drop without specifying they want all the bells and whistles, and you respond it's going to take you a week because you're planning to go all-out beyond necessary business requirements, they'd have a valid reason to be like "WTF mate?". Also this is still pretty paltry and not a week's worth of work.

Re:Declarative Dragging by dofm on Sunday November 08, 2026 @10:25PM (#50420672)
Did you ever actually do this work?

Do you remember what browser testing was like?

Remember the quirks of browsers’ different understanding of transparency, of z-index, of events, of DOM compliance?

I think the suggestion that getting it right could take a week in the context of a particular application is actually not particularly hyperbolic.

Mind you, I was doing cross-browser testing long enough ago that I am one of those people who can say they independently invented AJAX in-house.

Re:Declarative Dragging by anonymous908213 on Sunday November 08, 2026 @10:32PM (#50420715)
I've done it a dozen times in gamedev, where interfaces and interactivity are routinely built from scratch without any help of a framework. I didn't work on web applications in 2010, but even with the clusterfuck that the web is I find it difficult to believe it was that hard to do.
Re:Declarative Dragging by dofm on Sunday November 08, 2026 @10:43PM (#50420802)
It could be absolutely exasperating, even in 2010 (especially then since browser support for touch events was still shaking out).

The problem is that even without a framework, you didn’t have a blank slate (which would have been better). You had a moving target of blank slates, you had platform differences, you had drag vs touch-drag, entrenched older browsers and the simple frustration of testing on an array of real devices, all sorts.

Now, if you were talking about 2015, then it starts to get a bit flatter.

Re:Declarative Dragging by bryanrasmussen on Monday November 09, 2026 @12:36AM (#50421460)
so in short, you haven't done "this" work, you have done work in another field with different technical limitations that also has the concept of "drag and drop".

serious question, why, when people from a field you are unfamiliar with tell you that something has particular constraints in that field, do you confidently assert that you know better?

Re:Declarative Dragging by gf000 on Monday November 09, 2026 @02:12AM (#50422119)
From scratch is often way easier than in a browser-compatible way.
Re:Declarative Dragging by onion2k on Monday November 09, 2026 @03:25AM (#50422676)
even with the clusterfuck that the web is I find it difficult to believe it was that hard to do

This is how I feel about global illumination. Game devs claim it's hard but they're just noobs who don't know how to write a lighting shader.

I'm not a game dev, but it can't be that hard.

Re:Declarative Dragging by DonHopkins on Tuesday November 10, 2026 @10:09AM (#50441472)
[delayed]
Re:Declarative Dragging by penteract on Sunday November 08, 2026 @11:41PM (#50421143)
z-index is a CSS property, but doesn't work reliably on the web to always put something on top (IIRC, it positions it within its stacking context - there may be many nested stacking contexts). You need to somewhat carefully make a copy of the dragged DOM node (assuming the thing being moved is all in one DOM node), put it into a separate div which can be in front everything you want it to be in front of; and hide the ghost when you want to do hit testing for the drop. Also, you need to actually think about what you want the drop interaction to do wherever it might land (this last step could scale in complexity indefinitely depending on the webpage).
Re:Declarative Dragging by DonHopkins on Tuesday November 10, 2026 @11:14AM (#50442406)
[delayed]
Re:Declarative Dragging by pcthrowaway on Monday November 09, 2026 @01:22AM (#50421777)
2010 I'm pretty sure you had jQuery plugins to simplify drag&drop for a lot of use cases. But of course, if your use case was outside of the basic ones easily handled by a jQuery plugin, good luck!
Re:Declarative Dragging by ehnto on Sunday November 08, 2026 @08:46PM (#50419948)
I built a drag and drop content CMS/website builder in native Javascript years ago. The browser APIs are really cumbersome. The other issue is more UX than technical, there are lots of questions to answer. What are you dragging, what is it hovering over actually, what is the intention once it's dropped etc.
Re:Declarative Dragging by hdjrudni on Monday November 09, 2026 @01:05AM (#50421648)
Drag-and-dropping a file directly on the HTML `<input type="file">` file picker works with no code/JS.

If you want to splash up the "drop here" thing it's a frickin nightmare. The events don't fire when they should (e.g. mouse leave doesn't fire so it gets stuck, or you get duplicate events or missing events) so you get a bunch of flicker unless you do a bunch of debouncing and fail safes to cover all the browser quirkiness. And this is the easy drop-a-file scenario.

Doing all the stuff shown in https://www.youtube.com/watch?v=l7v-UwpsEbk I'm not sure I'd even know where to begin.

Re:Declarative Dragging by sn0wleppard on Monday November 09, 2026 @05:06AM (#50423510)
Dragging UI items around on a page is very different problem to dragging an external file onto a page
Re:Declarative Dragging by giwook on Sunday November 08, 2026 @06:51PM (#50419040)
I love when non-technical people think they know better than the technical people about technical things...
Re:Declarative Dragging by coffeeenjoyer on Monday November 09, 2026 @04:01AM (#50422968)
Re:Declarative Dragging by nielsbot on Monday November 09, 2026 @04:51AM (#50423385)
I think the Dragology stuff actually gets to the nub of what makes interactive drag-and-drop challenging: it's speculative live editing of a view into your model data.
Re:Declarative Dragging by cosmic-dancer on Monday November 09, 2026 @05:05AM (#50423505)
While it's a wrong assumption, I don't really think it's dumb for a non-technical person to assume this is fast to implement, and I don't think it's some epic own that he offered pushback on this even though he was wrong.
Re:Declarative Dragging by polarsanel on Monday November 09, 2026 @05:09AM (#50423544)
> do I need to give this to someone else

If said this way he was a jerk. So good on em for making a joke.

"Why would this take so long?" would be better.

Re:Declarative Dragging by cosmic-dancer on Monday November 09, 2026 @05:26AM (#50423681)
>do I need to give this to someone else

Could mean "I didn't know you had so much stuff on your plate that takes precedence". You're giving 0 benefit of doubt to a PM who in my opinion was right to push back because for a non-technical person it's not easy to grasp why drag and drop should be so much harder than other similar impact features.

Re:Declarative Dragging by flohofwoe on Monday November 09, 2026 @07:12AM (#50424527)
> to a PM who in my opinion was right to push back because for a non-technical person...

Ah and there's the rub. A PM in a software project should not be a non-technical person (because tbh what's even the point, how would a 'non-technical' person even be able to evaluate technical decisions and their implementation?)

Would you fly in a plane, or drive over a bridge that was built under supervision of a 'non-technical' PM?

Re:Declarative Dragging by Muromec on Monday November 09, 2026 @07:26AM (#50424669)
PM has to be nontechnical so they can manage the symptoms. PM also has to be technical to not trigger the worst of
Re:Declarative Dragging by IAmBroom on Monday November 09, 2026 @09:05AM (#50425808)
Or, they can simply be better at management.

The head of a space program doesn't need to be an astronaut. An admiral doesn't have to know how to swim. A PM doesn't have to know all the various engineering disciplines the project may touch.

The comment was derisive, and therefore poor leadership. Period.

Re:Declarative Dragging by polarsanel on Monday November 09, 2026 @02:47PM (#50430857)
You could be right. Depends on their tone and previous interactions. This is why it is good to have rituals and processes where e.g. you estimate a bunch of stuff at once and it is clear what kind of estimate it is. Effort, elapsed time or Tony's elapsed time given he is going to a conference Tue to Thu.
Re:Declarative Dragging by ChrisMarshallNY on Monday November 09, 2026 @06:09AM (#50424000)
One of the more complex early modules that I wrote, was an engine for selecting a crop of an image in a scanner control plugin.

It was crazy complicated.

Simple is not simple.

Re:Declarative Dragging by superxpro12 on Monday November 09, 2026 @10:22AM (#50426881)
everyone at my job knows to never utter the phrase "simple software change" when im within earshot.
Re:Declarative Dragging by rajnathani on Monday November 09, 2026 @10:25AM (#50426921)
It’s funny that you write this, as when I was at Salesforce, I picked up a nested list drag-and-drop task solo except-testing (as the “go to” UI person on the team), and it took me almost the entire release quarter to complete it. While it turned out good (and I remember the feature’s implementation getting praise by a senior manager at a sub-org demo meeting), that I was called into a team meeting for a “Root Cause Analysis” (paraphrasing) to discuss why the feature took so long to implement.
Re:Declarative Dragging by _doctor_love on Monday November 09, 2026 @11:09AM (#50427476)
My version of that is: “how hard could search be?! Just put a search box there!”

I wish I was making it up.