-
Notifications
You must be signed in to change notification settings - Fork 708
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
Let teachingtip treat placement logically not physically #3165
Let teachingtip treat placement logically not physically #3165
Conversation
@@ -1343,6 +1343,47 @@ void TeachingTip::ClosePopup() | |||
} | |||
} | |||
|
|||
winrt::TeachingTipPlacementMode TeachingTip::GetFlowDirectionAdjustedPlacement(const winrt::TeachingTipPlacementMode& placementMode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetFlowDirectionAdjustedPlacement [](start = 45, length = 33)
@jevansaks do you remember why we didn't do this for the initial check in? I know that we talked about it but I can't recall what we got hung up on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, unfortunately I don't remember either.
How confident are you in your manual testing. I think I remember this being more complicated than we thought. |
We should add a test which sets the flow direction to rtl |
I've added a test now which should test this quite thoroughly. My confidence in the manual tests I did jumped off a clip when I saw how many mistakes the TeachingTip "made" in the test. Should be good now though. |
@@ -350,6 +350,8 @@ public void SpecifiedPlacement() | |||
var targetRect = GetTargetBounds(); | |||
|
|||
// All positions are valid | |||
// The following might not always work, so repeat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The following might not always work, so repeat. [](start = 20, length = 50)
Really? what happens? was that the case before this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not entirely sure what the root cause is, however when running those tests locally, I noticed that the rect (and the red border we use to show it) don't always show up. The problem is that this leaves the TeachingTip to believe it has more space and fails the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wasn't this causing the test to fail before this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test was very unreliable on my machine before that change, only 20% of the time it actually ran through.
ScrollTargetIntoView(); | ||
ScrollBy(10); | ||
|
||
new CheckBox(FindElement.ByName("PageRTLCheckbox")).Check(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FindElement [](start = 33, length = 11)
Teaching Tip's test page uses the TeachingTipTestPageElements class to get things like this, I'd prefer that this get moved there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Fixed
SetPreferredPlacement(PlacementOptions.Center); | ||
VerifyPlacement("Center"); | ||
|
||
new CheckBox(FindElement.ByName("PageRTLCheckbox")).Uncheck(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FindElement [](start = 33, length = 11)
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Fixed
return winrt::TeachingTipPlacementMode::Center; | ||
} | ||
} | ||
return winrt::TeachingTipPlacementMode::Auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TeachingTipPlacementMode [](start = 18, length = 24)
Is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either this or a default cause for our switch case, otherwise not all code paths would return a value according to the compiler.
Since flow direction is not app wide but rather a propogating property. What happens if the teaching tip is LeftToRight but its target is RightToLeft? Like what would happen if you defined your teaching tip in you App.Resources and its target was in an RTL Panel. Does it maybe make more sense for the positioning logic use the flowLayout of the target where the content of the teaching tip would use the tip's flow layout? |
@ranjeshj curious what you think. |
That's a very good point. Maybe, reacting based on the target (if it exists) is actually the better idea. However I am not sure how common it is for a Page or part of an app to have a different flowdirection then the rest of the app. I think the main reason why we need to support RTL is for users who use RTL languages resulting in all apps being in RTL. In that case, it shouldn't really matter if we use the targets direction or the TeachingTips one. |
Not entirely sure. Adding @MikeHillberg and @YuliKl. How do we deal with this in a popup ? |
I agree that most of the time the flow direction of the target and the tip will be the same. The question is what is the right behavior when they aren't. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
🎉 Handy links: |
🎉 Handy links: |
Description
Every piece of code inside TeachingTip that handled the placement just took the values as is. I've added a function that returns the placementmode we want based on the flowdirection.
Motivation and Context
Closes #458
How Has This Been Tested?
Tested manually since the existing placement mode tests failed even if I just build master branch without any changes.
Screenshots (if appropriate):