Features
Automatic focus retention for cross list movement 🎩✨ #449
We now are smart about giving focus to a mounting draggable if it had focus while dragging
If you had any custom post drag focus logic you can now remove it
When you move component from one list to another in react, the default behaviour is for the component to loose focus. This is because the old DOM element is being destroyed and a new one is being created. Previously we recommended that you bolt on your own auto focus management to ensure that when moving to a new list that focus is maintained.
Given that this behaviour is so intuitive and important for keyboard dragging we have baked it right into the library.
We will now automatically focus on a drag handle if:
- It was unmounted at the end of a drag
- It had focus
- It is enabled when mounted
- No other elements have gained browser focus
We have sweated the details to make sure we are only focusing on what we should be.
Old behaviour
Without adding on your own post drag focus management this is what it was like
New behaviour 🤩
Without any custom post drag focus management
Thanks @petegleeson and @Blasz for helping me brainstorm and review this one