Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix bug where removal of TeachingTip would leave the Popup open #1327

Merged

Conversation

marcelwgn
Copy link
Collaborator

@marcelwgn marcelwgn commented Sep 13, 2019

Summary

Fixed a bug where the removal of the TeachingTip from the visual tree (e.g. by navigating to a different page) would leave the popup open and present.

Motivation

Fixes #509 and fixes #1426

Testing methodology

Add a TeachingTip which was targeted to a page specific item and opened the TeachingTip popup. After that I navigated to a different page and checked that the popup is closed.

@marcelwgn marcelwgn requested a review from a team as a code owner September 13, 2019 15:25
@jevansaks
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jevansaks
Copy link
Member

@chingucoding can you add a test to cover this scenario? If you haven't run the tests before you can use the Visual Studio test explorer. I wouldn't recommend doing a "run all" but you can run specific teachingtip tests. There's probably some tests that already do something similar (like clicking outside to close a light dismiss) and so you would be able to do something like navigate backwards and then check that the teachingtip is no longer present in the tree.

The test code is here: dev\TeachingTip\InteractionTests\TeachingTipTests.cs
The test page is: dev\TeachingTip\TestUI\TeachingTipPage.xaml

@marcelwgn
Copy link
Collaborator Author

Unfortunately I won't be able to fix this today, but I will add a test for that over the weekend.

@jevansaks
Copy link
Member

Unfortunately I won't be able to fix this today, but I will add a test for that over the weekend.

No problem! Also I'd like to assign to you the issues that you plan to fix. Would you mind adding a comment in the issues you're picking off like "I'll fix this" -- adding the comment enables me to assign the issue to you.

@marcelwgn
Copy link
Collaborator Author

I have added the new test. In addition to this I also made sure that the unloading of the TeachingTip will set its open state to false.

@jevansaks jevansaks added the release note PR that we want to call out in the next release summary label Sep 16, 2019
@jevansaks
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -15,6 +15,7 @@ TeachingTip::TeachingTip()
__RP_Marker_ClassById(RuntimeProfiler::ProfId_TeachingTip);
SetDefaultStyleKey(this);
EnsureProperties();
Unloaded({ this, &TeachingTip::ClosePopupOnUnloadEvent });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unloaded({ this, &TeachingTip::ClosePopupOnUnloadEvent }); [](start = 4, length = 58)

I'm slightly concerned about how this will appear to behave to the developer. Teaching tips can be declared anywhere and I'm not positive under which circumstances the tip will be loaded (and thus unloaded). I did some experiments placing the teaching tip in different resource dictionaries and it behaves as I would expect, but I wonder if we haven't thought about all the scenarios.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

We have an open conversation about whether or not the closing animation should play in these scenarios, once we answer the question I'll merge this in or update the change.

Additionally we want to have the same behavior when the target of the tip is unloaded, I've opened a new issue for that #1426.

@marcelwgn
Copy link
Collaborator Author

marcelwgn commented Oct 10, 2019

We have an open conversation about whether or not the closing animation should play in these scenarios, once we answer the question I'll merge this in or update the change.

👍

Additionally we want to have the same behavior when the target of the tip is unloaded, I've opened a new issue for that #1426.

Would this be something this PR should also cover? I think fixing #1426 would work in a very similar way.

@StephenLPeters
Copy link
Contributor

We have an open conversation about whether or not the closing animation should play in these scenarios, once we answer the question I'll merge this in or update the change.

👍

Additionally we want to have the same behavior when the target of the tip is unloaded, I've opened a new issue for that #1426.

Would this be something this PR should also cover? I think fixing #1426 would work in a very similar way.

It doesn't have to be, but can be if you wanted to tackle that too :). We have decided that no animation is correct so this change is good. The added part for target would be to attach ClosePopupOnUnloadedEvent to the target's unloaded event (and detach when the target is changed or removed etc.)

@marcelwgn
Copy link
Collaborator Author

We have an open conversation about whether or not the closing animation should play in these scenarios, once we answer the question I'll merge this in or update the change.

👍

Additionally we want to have the same behavior when the target of the tip is unloaded, I've opened a new issue for that #1426.

Would this be something this PR should also cover? I think fixing #1426 would work in a very similar way.

It doesn't have to be, but can be if you wanted to tackle that too :). We have decided that no animation is correct so this change is good. The added part for target would be to attach ClosePopupOnUnloadedEvent to the target's unloaded event (and detach when the target is changed or removed etc.)

I can work on this but I might not be able to get to this soon. 😅
@jevansaks If thats okay, you can assign me to #1426 .

@jevansaks
Copy link
Member

@jevansaks Jevan Saks FTE If thats okay, you can assign me to #1426 .

Happily, @chingucoding! Can you add a comment to that issue so i can assign it to you? (GitHub won't let me do it if you haven't commented).

@marcelwgn
Copy link
Collaborator Author

I have updated the OnPropertyChanged to add the ClosePopupOnUnloadEvent function to the new targets Unload event when the TeachingTip receives a new target and unregister from the old target (only if those are not null of course).

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

I'll merge once the CI gates come back. Thanks for doing this @chingucoding and your patients getting it in.

@marcelwgn
Copy link
Collaborator Author

I'll merge once the CI gates come back. Thanks for doing this @chingucoding and your patients getting it in.

Always happy to help! Thank you for your help 😄

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters StephenLPeters merged commit 21b1a6e into microsoft:master Oct 22, 2019
@marcelwgn marcelwgn deleted the teachingtip-closepopupunload branch April 16, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release note PR that we want to call out in the next release summary
Projects
None yet
3 participants