Keep the active tab within a group when closing
Additionally, slightly refactor DetermineNewSelectedIndex() so that it feels less upside-down: handle the "closing inactive tab" case first. Judging by the tests and the way this is called in TabStripModel::DetachWebContentsImpl(), this is the intended order of behavior. I wasn't able to manually reproduce a case where a grouped tab has an opener. I believe this is actually a different bug in groups: when a tab is opened by an opener, it doesn't get grouped. I'll log this separately (it's already in the Remaining Work doc for Tab Groups). For now, I kept the group logic after the opener logic, so that in most cases it will continue to behave as before. From my experimentation, this works as expected when closing multiple tabs at once, including if they're non-consecutive or in different groups. The behavior just falls back to closing one tab at a time, so it will respect the group of the rightmost tab, which is the last to become active (see TabStripModel::DetachWebContentsImpl()). Bug: 992512 Change-Id: I347fc52c0b0a2b5aca84a3ad2e4a6264bf8b11ee Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834641 Commit-Queue: Connie Wan <connily@chromium.org> Reviewed-by:Taylor Bergquist <tbergquist@chromium.org> Reviewed-by:
Bret Sepulveda <bsep@chromium.org> Cr-Commit-Position: refs/heads/master@{#702625}
Showing
Please register or sign in to comment