Bug 1663041 Comment 16 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I found the problem that was causing the erratic focus.

Using the `this.removeSelectedPills()` method is not necessary in this case because the user is not deleting pills, but we are before recreating them.
That method has some very refined conditions that Thomas created to properly manage the focus when deleting pills, which was interfering with the `createDNDPills` method.

Another issue was the fact that we were moving the focus on the input field.
That causes the removal of the selection from all the pills, since we have that method `onFocus` in the field, which is correct.

We should move the focus on the first selected pills we just moved, to guarantee consistency.
Here's an updated patch for you to test.

One last thing to implement before the r+ here is to prevent moving all the currently selected pills if the drag action starts from a pill that isn't selected.
So, for example:
- You have 6 pills, **3 are selected**.
- You start the drag action from a **selected** pill, the 3 pills are dragged.
- You start the drag action from an **unselected** pill, only the newly clicked pill is dragged and the other 3 previously selected pills are unselected.
I found the problem that was causing the erratic deselection of pills.

Using the `this.removeSelectedPills()` method is not necessary in this case because the user is not deleting pills, but we are before recreating them.
That method has some very refined conditions that Thomas created to properly manage the focus when deleting pills, which was interfering with the `createDNDPills` method.

Another issue was the fact that we were moving the focus on the input field.
That causes the removal of the selection from all the pills, since we have that method `onFocus` in the field, which is correct.

We should move the focus on the first selected pills we just moved, to guarantee consistency.
Here's an updated patch for you to test.

One last thing to implement before the r+ here is to prevent moving all the currently selected pills if the drag action starts from a pill that isn't selected.
So, for example:
- You have 6 pills, **3 are selected**.
- You start the drag action from a **selected** pill, the 3 pills are dragged.
- You start the drag action from an **unselected** pill, only the newly clicked pill is dragged and the other 3 previously selected pills are unselected.

Back to Bug 1663041 Comment 16