Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closing Active document always selects first document, instead of previous #201

Closed
Muhahe opened this issue Sep 8, 2020 · 3 comments · Fixed by #409
Closed

Closing Active document always selects first document, instead of previous #201

Muhahe opened this issue Sep 8, 2020 · 3 comments · Fixed by #409

Comments

@Muhahe
Copy link
Contributor

Muhahe commented Sep 8, 2020

When you have multiple documents opened e.g.

Doc1, Doc2, Doc3, Doc4

and Doc4 IsActive and then you close Doc4 (still as active document), new active document will be Doc1 (or any document that is on index 0;

From my point of view i expect, to Doc3 will be selected (or any previous document).

When i looked into code, i noticed that

LayoutElement.cs 76 -> is raising OnParentChanging in Parent setter with new value Null
LayoutContent.cs 692 -> is setting IsSelected property to false for old document
LayoutContent.cs 154 -> setting SelectedContentIndex on parentSelector to -1

and then when AutoFixSelectedContent is called, correct SelectedContentIndex is never set

You can try this in yout TestApp simply by adding more than 3 documents, then set last to active and then close it

@zaksmolen
Copy link

I'm seeing the same behavior as well. The previous selected index is always -1, which seems to follow the behavior you described in code.

@zaksmolen
Copy link

We are still seeing this years later. I have looked into the code a bit but I am not familiar enough with the codebase to identify why it doesn't properly track the previous index.

@L45eMy
Copy link
Contributor

L45eMy commented Dec 19, 2022

The previous index seems to be irrelevant. This issue was added in 4927453 when the code was removed, that identifies the previous selected tab via the LastActivationTimestamp. I'm not sure which bug should be resolved by this, so I have added this code again.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants