Closed Bug 1785314 Opened 2 years ago Closed 2 years ago

After deleting a contact, first contact in list gets selected and search box is focused

Categories

(Thunderbird :: Address Book, defect)

Thunderbird 102
defect

Tracking

(thunderbird_esr102 fixed)

RESOLVED FIXED
107 Branch
Tracking Status
thunderbird_esr102 --- fixed

People

(Reporter: thomas8, Assigned: darktrojan)

References

(Blocks 2 open bugs)

Details

(5 keywords)

Attachments

(2 files, 1 obsolete file)

102.1.2 (64-bit), Win10 (same on Daily 105.0a1 (2022-08-16) (64-bit))
This could be considered a regression (the behaviour has changed and is less useful than before, although we may want another behaviour compared to TB 91).

Henry, could this be caused by Bug 1775245? Would this be fixed by one of the bugs on record, e.g. Bug 1752532 (in which case this should depend on that)?
Maybe Alice can identify a regression range after we get a comment from Henry.

STR

  • local AB with 4+ contacts
  • select contact #3
  • press Del key, confirm deletion
  • observe focus and selection

Actual

  • first contact gets selected - why? This isn't helpful, in fact, it's error-prone especially in combination with next, because now I have a selected contact in the list which I never selected.
  • focus ends up in search box - not totally bad, but why? (Or did I suggest this myself??) makes deleting other single contacts from the same list harder, and is a bit jumpy/unexpected.

Expected

  • not totally sure, but probably something along the lines of what Henry described on https://phabricator.services.mozilla.com/D151390:

    When deleting a focused and selected item, we try and select the next item that was not deleted, or (if there's no next item) the last item of the list. This prefers keeping the selection at the same position.

  • probably no need to jump focus into search box

Note:

  • TB 91 used to focus, but not select the first item in the list after deleting an item (which imo was better than now).
    Maybe this was to prevent accidentally deleting more addresses than intended by holding Del a little to long when we didn't have a confirmation for deleting contacts yet. But now with confirmation, Henry's proposed behaviour will probably feel more natural while still being relatively safe against errors.
Flags: needinfo?(henry)
Flags: needinfo?(alice0775)
Severity: -- → S3

(In reply to Thomas D. (:thomas8) from comment #0)

Henry, could this be caused by Bug 1775245? Would this be fixed by one of the bugs on record, e.g. Bug 1752532 (in which case this should depend on that)?

Bug 1775245 only effected "tree-listbox", but the contact list uses "tree-view-listbox". Bug 1752532 would switch the element from using nsTreeSelection to SelectionWidgetController, which should handle re-assigning focus and selection after deleting. But since this is likely a regression from Bug 1757860 it could probably be handled before.

Flags: needinfo?(henry)
Blocks: tb102found

Do you have an idea what the behavior should be with the deletion of multiple selected contacts with contacts in between?
Should it be the next contact of the last selected chosen?

Flags: needinfo?(bugzilla2007)

(In reply to Nicolai Kasper from comment #3)

Do you have an idea what the behavior should be with the deletion of multiple selected contacts with contacts in between?
Should it be the next contact of the last selected chosen?

Good question. I think the answer is yes. Note that focus can be anywhere (even outside the selection), so probably we shouldn't rely on that.
In favor of your suggested solution, it could be argued that when user bothered to select individual entries, he may be done with the parts of the list included in that selection, and proceeding with the next item outside the selection (if such exists) may make sense.

Flags: needinfo?(bugzilla2007)
Assignee: nobody → nicolai
Status: NEW → ASSIGNED
Target Milestone: --- → 106 Branch
Attachment #9291309 - Attachment is obsolete: true
Assignee: u695164 → geoff
Target Milestone: 106 Branch → ---

This sets the list's current index back to what it was before items were deleted.
Without this patch the current index becomes -1 if the selected row is removed, and then the first item is automatically selected when the list gains focus.

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/2346cf4b98ce
Fix focus and cards list selection when a contact is deleted. r=aleca

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch

Comment on attachment 9297066 [details]
Bug 1785314 - Fix focus and cards list selection when a contact is deleted. r=aleca

[Approval Request Comment]
Regression caused by (bug #): new address book
User impact if declined: selection jumps somewhere unexpected when the selected item is deleted
Testing completed (on c-c, etc.): in 107b1
Risk to taking this patch (and alternatives if risky): low

Attachment #9297066 - Flags: approval-comm-esr102?

Comment on attachment 9297066 [details]
Bug 1785314 - Fix focus and cards list selection when a contact is deleted. r=aleca

[Triage Comment]
Approved for esr102

Attachment #9297066 - Flags: approval-comm-esr102? → approval-comm-esr102+

The changes to browser_edit_card.js build upon changes made in bug 1774702, which is not on c-esr102 (likely due to the new strings).

Options, uplift bug 1774702 - 7/10 top 10 have the string, 29/67 overall. Not great.
Or uplift this bug without the test changes, or at least without the changes that have to deal with the delete button added in 1774702.

Flags: needinfo?(alessandro)

Or uplift this bug without the test changes, or at least without the changes that have to deal with the delete button added in 1774702.

Yeah, I'm leaning towards this option as adding too many untranslated strings this late into ESR is not great.

Flags: needinfo?(alessandro)

[Triage Comment]
This is the same patch, minus the test changes related to test_remove_button() from bug 1774702. There are minor differences in the chunk contexts compared to the original.

Attachment #9299962 - Flags: approval-comm-esr102+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: