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

NavigationViewItem: Empty tooltip no longer shown #3430

Conversation

Felix-Dev
Copy link
Contributor

Description

This PR fixes an issue where an (empty) tooltip was shown for a NavigationViewItem with its content set to the empty string.

Motivation and Context

Fixes #3427

How Has This Been Tested?

Tested visually and added API test.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Oct 15, 2020
@StephenLPeters StephenLPeters added area-NavigationView NavView control team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Oct 15, 2020
@marcelwgn
Copy link
Collaborator

marcelwgn commented Oct 16, 2020

The test if failing on my machine, and with the changes.

@Felix-Dev
Copy link
Contributor Author

@chingucoding

Test runs fine for me:
image

Tooltips show up as expected:
navview-tooltips

PR branch is up-to-date with master.

@marcelwgn
Copy link
Collaborator

marcelwgn commented Oct 16, 2020

Edit: It was not, it was me not knowing what should expose tooltips.

I think that this is a regression with ToolTip service in the latest insider build, other tooltips are also failing on my machine now too.

@StephenLPeters
Copy link
Contributor

I think that this is a regression with ToolTip service in the latest insider build, other tooltips are also failing on my machine now too.

@YuliKl do we know about this?

@StephenLPeters StephenLPeters added the needs-triage Issue needs to be triaged by the area owners label Oct 16, 2020
@StephenLPeters
Copy link
Contributor

@chingucoding can you provide an example of your tooltips not working? if this is broken we need to track it down. Is it unique to uwp app? what about the title bar tooltips?

@Felix-Dev
Copy link
Contributor Author

Felix-Dev commented Oct 16, 2020

@chingucoding @StephenLPeters I've updated to the newest 20236 Insider build in my insider VM and checked the XAML Controls Gallery app there. All tooltips seemingly work fine (NavigationView tooltips, titlebar tooltips, tooltips on the XCG's ToolTip page,...).

In Windows itself, the shell tooltips appear to work just fine too (small tiles' tooltips in the start menu and Win32 tooltips in the task bar).

So the issue @chingucoding is seeing might not be present on every device running the newest insider build and might be caused by some stuff like A/B testing, different device configurations,...

@marcelwgn
Copy link
Collaborator

marcelwgn commented Oct 17, 2020

Edit: Tooltips work normally on my machine.

The new test that Felix added in this PR fails with the following:

Image showing that the ToolTip of NavigationViewItem 4 is null which is a failure

The failures were encountered on version 10.0.20236 Build 20236.

@Felix-Dev
Copy link
Contributor Author

Felix-Dev commented Oct 17, 2020

@chingucoding I assume you have tested the WinUI NavigationView in Left mode with the pane closed? Only in that case (when we just show the "navigation strip") do we currently show tooltips for the NavigationViewItems. When the pane is open, as in your posted gif, we do not show tooltips:

bool NavigationViewItem::ShouldEnableToolTip() const

That said, should we consider changing that? I view tooltips as one way to convey information to the user which otherwise might not fit on the screen. Right now, if I set a NavigationViewItem content long enough to not fit into the NavigationView pane, then I only see the tooltip when I close the pane.

<muxc:NavigationView>
    <muxc:NavigationView.MenuItems>
        <muxc:NavigationViewItem Icon="Home" Content="Quite a long description which should not fit entirely" />
    </muxc:NavigationView.MenuItems>
</muxc:NavigationView>

image

We already expose APIs to configure the width of the open pane (for example NavigationView.OpenPaneLength) and in the future, we might make pane resizing even easier available to customers as proposed in #190. Point being that the open pane length could be changed by app users (if supported by the developer) to a new width where some menu items might not entirely fit into the opened pane width any longer. Tooltips can be used then to still show the entire menu item content.

Another aspect might be a fixed open pane length but due to localization, in some supported app languages we might have translated strings which don't entirely fit into the available space whereas they would (easily) fit in other app languages. So while the open pane length would stay the same across app language changes, the menu item's content width could be increased and suddenly not fit into the available space any longer.

Thus, I think we should show tooltips even when not in closed compact mode while using Left navigation. For Top navigation, no menu item content will be cutoff. If the item doesn't fit into the space currently available, it will be moved into the overflow menu which will take enough space to show the entire menu item (icon + content).

@StephenLPeters @YuliKl Your thoughts?

@marcelwgn
Copy link
Collaborator

marcelwgn commented Oct 17, 2020

@chingucoding I asume you have tested the WinUI NavigationView in Left mode with the pane closed? Only in that case (when we just show the "navigation strip") do we currently show tooltips for the NavigationViewItems. When the pane is open, as in your posted gif, we do not show tooltips:

I did in fact not, that tooltip works. So it was just me not knowing when tooltips of NavView show, sorry about that.

Still, the test failure remains. Looking at the code, I think the reason why it failed on my machine is that the API test was run on a screen large enough to expand the pane resulting in not showing the tooltip. The CI machines also run through fine as their resolution is HD.

Adding navView.PaneDisplayMode = NavigationViewPaneDisplayMode.LeftCompact; fixes the test for me. Maybe we can add that or enforce the CI dimensions for API tests too?

@ranjeshj ranjeshj removed the needs-triage Issue needs to be triaged by the area owners label Oct 19, 2020
@StephenLPeters
Copy link
Contributor

@chingucoding I think enforcing CI dimensions for API tests makes sense, Lets open a new issue for that.

@YuliKl can you weigh in on felix's tooltip question?

{
if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
{
Log.Warning("On RS4 and earlier the test needs to be modified slightly.");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should only be a placeholder for now. The tooltip implementation changed with RS5+ and I can only test that behavior on my local machine for now. I do not have a VM up and running RS4 and earlier yet. Since I cannot locally test that scenario, I haven't written a test case for it yet, though the implementation used in RS4 and below still exists and I could write a test based on the source code. Testing that would have to rely on the test pipeline then to spot any errors made when writing that test.

Should I go ahead and create a test based on the available implementation?

{
if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
{
Log.Warning("On RS4 and earlier the test needs to be modified slightly.");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above.

@Felix-Dev
Copy link
Contributor Author

@YuliKl The Groove music app shows another scenario where showing tooltips even when the pane is open in Left mode is useful:
image

Groove allows the user to create custom playlists (with custom names without name length limitation) so the chosen playlist name might not fit the pane width entirely. A tooltip can be used to show the entire name to the user.

I think, alongside the other points I mentioned earlier, that it makes sense to show tooltips by default in Left mode (pane open/closed) so that developers don't have to take care of that.

@ranjeshj
Copy link
Contributor

@Felix-Dev can you please merge with master ? Thanks!

@Felix-Dev
Copy link
Contributor Author

Felix-Dev commented Nov 23, 2020

Merged with master.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

@Felix-Dev I'm trying to find the discussion we had a while back about the dificulties you had with getting VS to recognize the new API test project you added. Do you happen to know where that discussion was? Sorry not really related to this PR at all.

@Felix-Dev
Copy link
Contributor Author

Felix-Dev commented Nov 23, 2020

@StephenLPeters Do you perhaps mean this conversation?

@StephenLPeters
Copy link
Contributor

Hmm, I think so. Thank you!

@StephenLPeters StephenLPeters merged commit 6ab8ecc into microsoft:master Feb 13, 2021
@ghost
Copy link

ghost commented Mar 5, 2021

🎉Microsoft.UI.Xaml v2.6.0-prerelease.210227001 has been released which incorporates this pull request.:tada:

Handy links:

Kinnara added a commit to Kinnara/ModernWpf that referenced this pull request Oct 24, 2023
Kinnara added a commit to Kinnara/ModernWpf that referenced this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NavigationView NavView control team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NavigationViewItem: Empty tooltip is shown when content is set to the empty string
4 participants