New onBeforeCapture
responder #1588
<DragDropContext /> | onBeforeCapture
is called after we know a drag will start, but before any dimensions have been collected from the DOM. It is an opportunity to add or remove <Draggable />
and <Droppable />
components, or modify element sizes.
⚠️ Warning: this is pretty powerful and it can be used to do great things, as well as terrible things.
For more details, check out our responders guide
In the following example, I am adding a trash bin (<Droppable />
) in onBeforeCapture
with some items (<Draggable />
) in it to show off the kind of thing you can do ♻️
Responder lifecycle
+ 1. `onBeforeCapture`: a drag is about to start and dimensions have **not been collected** from the DOM
2. `onBeforeDragStart`: a drag is about to start and dimensions **have been captured** from the DOM
3. `onDragStart`: A drag has started
4. `onDragUpdate`: Something has changed during a drag
5. `onDragEnd` **(required)**: A drag has ended. It is the responsibility of this responder to synchronously apply changes that has resulted from the drag
This change resulted in a
minor
version bump
Fixes
- Fixing issue with announcer and hot module reloading #1584. Thanks @Mangatt for raising this one ❤️
- Improving the accessibility of lift instructions #1568. Thanks @flacerdk for finding this and @seancurtis for the fix! @seancurtis went the extra mile and also created a
jest-axe
help us have even better accessibility coverage. It seems to pick up a bit more than our existinglighthouse
build - Fixing typo in our reparenting pattern. Thanks @TrySound for raising it
These fixes resulted in a
patch
version bump (which got eaten by theminor
version bump)