Conversation
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/AddMappingDialog.xaml.cs
Show resolved
Hide resolved
| OnActivateAsync(e, CancellationToken); | ||
|
|
||
| }, Resources.PackageSourceMappingOptions_OnActivated); |
|
|
||
| public override string ToString() | ||
| { | ||
| return ID + " " + SourcesString; |
There was a problem hiding this comment.
I was unable to drill-in to the controls using Narrator or NVDA, but I think it's important to announce the Sources List when visiting a list item. Let me know any better suggestions. Our Package Sources page also announces both Source Name and URL in one take.
The way I'm implementing this is a string concatenation. Narrator and NVDA pause briefly between each comma in the sources list.
| /// </summary> | ||
| public static string PackageSourceMappingOptions_OnActivated { | ||
| get { | ||
| return ResourceManager.GetString("PackageSourceMappingOptions_OnActivated", resourceCulture); |
There was a problem hiding this comment.
See OnActivate comment if you're curious where this string actually gets used. #4847 (comment)
| Dictionary<PackagePatternItem, PackagePatternItem> otherPatterns = packageSourceMappingSourceItem.Patterns.ToDictionary(c => c, c => c); | ||
| var immutablePatterns = new List<PackagePatternItem>(Patterns); | ||
| foreach (PackagePatternItem packagePatternItem in immutablePatterns) | ||
| var clonedPatterns = new List<PackagePatternItem>(Patterns); |
There was a problem hiding this comment.
While reading this code, I realized that "immutable" isn't accurate.
|
|
||
| var newValue = (e.RoutedEvent == CheckBox.CheckedEvent); | ||
| var oldValue = !newValue; // Assume the state has actually toggled. | ||
| AutomationPeer peer = UIElementAutomationPeer.FromElement(itemContainer); |
| Background="{Binding Path=(Window.Background), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" | ||
| TextChanged="PackageID_TextChanged"/> | ||
| <StackPanel Orientation="Vertical" Grid.Row="1"> | ||
| <nuget:ProjectsListView AutomationProperties.Name="Sources List" |
There was a problem hiding this comment.
The control I needed to reuse was unfortunately named specifically for Projects list, but I'll refactor that in a separate PR: https://github.com/NuGet/Client.Engineering/issues/1903
| var viewModel = new SourceMappingViewModel(packageID, uiSourceMappings[packageID]); | ||
| mappingsCollection.Add(viewModel); | ||
| } | ||
| mappingsCollection.Sort((a, b) => StringComparer.OrdinalIgnoreCase.Compare(a.ID, b.ID)); |
There was a problem hiding this comment.
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/PackageSourceMappingOptionsControl.xaml.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/PackageSourceMappingOptionsControl.xaml.cs
Outdated
Show resolved
Hide resolved
|
Looks great! Some minor UI feedback:
|
|
Great to hear from you!
Yes, in VS Options, we use a Help button "?" (see below), and that's why the Documentation section of this PR calls out creating a new Docs page:
@nkolev92 did we agree that "package ID" implies pattern, or do we need to state the word pattern? I believe we discussed this, so I don't want to make last minute changes. Also consider that the docs will help explain how this works.
I'm not sure that adding lengthy URLs into the list is going to make anything easier to distinguish. |
I think we should call it package pattern, https://learn.microsoft.com/en-us/nuget/consume-packages/package-source-mapping#package-pattern-syntax. The docs call out I'll review the whole PR, but I'm pretty confident package pattern is the right one in this case, as it's what specifically came up with to be able to refer to both package id and package prefixes. |
|
Has that help button always been there??? I've never noticed it before 🤯
Hm, another potential alternative could be a tooltip on hover that adds more details. |
dominoFire
left a comment
There was a problem hiding this comment.
Partial review. Please address AutomationProperties.Name comments. Thanks! Good job!
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/SourceMappingViewModel.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/Models/ItemsChangeObservableCollectionBase.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/AddMappingDialog.xaml
Outdated
Show resolved
Hide resolved
| <GridViewColumn> | ||
| <GridViewColumn.CellTemplate> | ||
| <DataTemplate> | ||
| <CheckBox AutomationProperties.Name="SourcesCheckBox" |
There was a problem hiding this comment.
| <CheckBox AutomationProperties.Name="SourcesCheckBox" | |
| <CheckBox AutomationProperties.Name={x:Static nuget:Resources.PackageSourceCheckBox_AccessibleName} |
There was a problem hiding this comment.
I found 2 approaches in existing code:
-
Package Items have a checkbox for the Updates tab. I decided to mimic this behavior. Narrator reads "Selected" when visiting the checkbox:
-
In the Projects List of Solution PMUI, we have a more complicated usage of AutomationProperties. The
Namerepeats the projectname.HelpTextgives a sentence about what it means to select this item.
I'm not sure if either is warranted for this checkbox. Result for Narrator when drilling-in to this checkbox, it announces "Selected checkbox (Un)Checked".
I feel approach 1 is a better first step given the intent of the window and the behavior of the checkbox are announced indirectly by the screen-reader. PMUI Package list works similarly. We can expand the verbosity of AutomationProperties, if necessary.
There was a problem hiding this comment.
I'm good with Approach #1 as long as it's reviewed by A11y team.
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/AddMappingDialog.xaml.cs
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/AddMappingDialog.xaml.cs
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/AddMappingDialog.xaml
Outdated
Show resolved
Hide resolved
Yes! Although I think not all pages implement it, it used to be the de facto documentation button.
@loic-sharma These are good ideas; however, reviewing this with UX folks, they don't feel there's a problem with distinguishing between the comma-delimited list. They actually suggested an Edit dialog as a solution to that problem, which we have considered after this first iteration. The idea is if you can re-open the dialog to edit a Mapping, the user can see the checkbox-list of sources (more concrete than the list). Do you feel that would resolve your concern? |
804eff1 to
e99fd73
Compare
|
Modified Watermark in textbox for adding a new mapping to include an example: e99fd73
@nkolev92 please let me know if the new text adequately addresses your concern. |
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/AddMappingDialog.xaml.cs
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/Options/PackageSourceMappingOptionsControl.xaml.cs
Show resolved
Hide resolved
This reverts commit 9f30979.
…g for slow loading
@nkolev92 - The harm is that it will wrap the call in a JTF.Run, which is not accomplishing anything logically. |
18f3037 to
0934c5f
Compare








Bug
Fixes: NuGet/Home#11362
Fixes: NuGet/Home#11363
Regression? Last working version:
Description
(Content copied from #4711 which this PR supersedes).
There is currently no support for package source mapping in the VS options UI. These changes allow the user to see all package source mappings in a new
Package Source Mappingoptions dialog, and toAdd,Remove, orClearRemove Allmappings. Here is a screenshot of this dialog showing the mappings for NuGet.sln:When a user clicks

Add, a new window appears, and the user can type in a package namespace and select from all the previously configured sources for that project to map to. Here is a screenshot showing this window:There were some concerns about the modal dialog and the amount of whitespace in the
ListViewshowing package source mappings, but the UX Board checked it and said it was okay.PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
ListViewshowing the package source mappings in thePackage Source Mappingsoptions dialog shows the wrong value for theIsOffScreenproperty for mappings not in view. This issue appears in other VS options dialogs that have aListViewand is mentioned in this issue: Inconsistent UIA IsOffscreen and ClickablePoint properties for WPF ListViewItems that are scrolled out of view dotnet/wpf#4631 , so I decided not to fix it.OR
- [ ] Test exception
- OR
- [ ] N/A
Documentation