How to enable “shift-click to edit this widget” functionality on a custom widget?

In my custom widgets, I had omitted adding the ID to ‘before_widget’ markup, as I wasn’t using the IDs for styling. Turns out this is what the Customizer JS is using to target the widgets. (duh)

So, including the proper ID in the widget output makes everything work as it should.