-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Represent inheritance in Settings UI #8919
Conversation
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed); | ||
} | ||
} | ||
|
||
// update visibility for override message | ||
if (auto overrideMsg{ obj.GetTemplateChild(L"OverrideMessage") }) | ||
{ | ||
if (auto elem{ overrideMsg.try_as<UIElement>() }) | ||
{ | ||
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed); |
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.
can you not bind these to {TemplateBinding HasSettingValue}
inside the template?
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.
This is another one that doesn't make sense to me. I tried just that, but the visibility is initialized to Visible
regardless of HasSettingValue
(even setting HasSettingValue
's default value to false results in no different behavior). Figured this might be an OnApplyTemplate
thing that's getting in the way of initializing the value properly?
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.
hmm.
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.
Still surprised by this. I'm gonna check out your branch and have a look-see. 😄
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.
did a first pass, will come back again
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed); | ||
} | ||
} | ||
|
||
// update visibility for override message | ||
if (auto overrideMsg{ obj.GetTemplateChild(L"OverrideMessage") }) | ||
{ | ||
if (auto elem{ overrideMsg.try_as<UIElement>() }) | ||
{ | ||
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed); |
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.
hmm.
Base layer is still a bit wonky. Polish in that area is coming up next. |
Base layer is treated no differently. Long-term, the idea is that "Overrides a setting" will be replaced with a link to the source. Base layer will say something like "Overrides default setting" and we'll link to a view of defaults.json in SUI. |
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed); | ||
} | ||
} | ||
|
||
// update visibility for override message | ||
if (auto overrideMsg{ obj.GetTemplateChild(L"OverrideMessage") }) | ||
{ | ||
if (auto elem{ overrideMsg.try_as<UIElement>() }) | ||
{ | ||
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed); |
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.
Still surprised by this. I'm gonna check out your branch and have a look-see. 😄
const auto& helpText{ HelpText() }; | ||
if (!helpText.empty()) | ||
{ | ||
Controls::ToolTipService::SetToolTip(obj, box_value(helpText)); | ||
Automation::AutomationProperties::SetHelpText(obj, helpText); | ||
} |
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.
surprised you couldn't do some binding work to make this happen actually. You should be able to {TemplateBinding HelpText}
inside the xaml file. Don't block on this. Just curious.
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.
Same for {TemplateBinding Header}
on automation property
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.
Okay, I think I can wrap my head around this. I don't have anything that wasn't already called out, but there's enough other comments that I'll hold off approving till they're fixed.
A large contribution to #8899 has happened (mostly automatically) in this PR. #8899 cannot be closed, however, because there's still some work to be done on non-setting ui elements (i.e. discard changes & save buttons, open json button, etc...). I could do that here, but I feel that that's too out of scope for this PR. |
Leaving assigned to Carlos because of the discussion we had on Teams. Summarized here:
|
This is really annoying. I've tried various methods and the
The code runs properly in both cases, but the automation client (i.e. screen reader) refuses to acknowledge that the value changed (so frustrating!). I've decided to do the following approach instead:
I've also investigated a bit of what's going to happen when we add a hyperlink in the override message. For whatever reason, hyperlinks do not provide any automation properties automatically. So the user would tab to the hyperlink, and not be read anything. I think the right move there would be to keep the proposed design above, and add the following auto props to the hyperlink:
I feel like that'll still be somewhat intuitive. And the reset button is described such that the user is in the context of overriding a setting. |
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.
This is an excellent piece of work. Well done. Just the one nit, then we can GO GO GO.
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.
Sure lets do it
Hello @carlos-zamora! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
- 0b0dbdf Makes the browse buttons center vertically aligned - This is now made possible by #8919. The "center" used to include the height of the header. Now that it's separated, the center is solely calculated to be the text box. - Closes #8764 - 0288f06 Fix keyboard navigation focus for color schemes rename button - Enter/Esc when in the scheme renamer now focuses the combo box - Keyboard-invoking accept/cancel button focuses the rename button - References #8765 and #8768 - d5ef552 Cyclical tab navigation - now, if you try to tab past the save button, you cycle back to the beginning of the navigation view - this is consistent with the xaml controls gallery - References #8768 - a613b08 AutomationProperties for Save, Reset, and open json buttons - References #8899
This PR adds improved override message generation for inheritance in SUI. The settings model now has an `OriginTag` to be able to denote where a `Profile` came from. This tag is used in the `SettingContainer` to generate a more specific override message. ## References #6800 - SUI Epic #8919 - SUI Inheritance PR #8804 - SUI Inheritance (old issue) ## Detailed Description of the Pull Request / Additional comments - **Terminal Settings Model** - Introduced `PROJECTED_SETTING` as a macro to more easily declare the functions for each setting - Introduced `<setting>OverrideSource` which finds the `Profile` that has \<setting\> defined - Introduced `OriginTag Profile::Origin {Custom, InBox, Generated}` to trace where a profile came from - `DefaultProfileUtils` creates profiles for profile generators. So that now sets the `Origin` tag to `Generated` - `CascadiaSettings::LoadDefaults()` tags all profiles created as `InBox`. - The view model had to ingest the API change to be able to interact with `<setting>OverrideSource` - **Override Message Generation** - The reset button now has a more specific tooltip - The reset button now only appears if base layer is being overridden - We use the settings model changes to determine the message to display for the target ## Validation Steps Performed Tested the following cases: - overrides nothing (inherited setting) - overrides value inherited from... - base layer - a profile generator - in-box profile - global settings should not have this feature
🎉 Handy links: |
Summary of the Pull Request
Introduces the
SettingContainer
.SettingContainer
is used to wrap a setting in the settings UI and provide the following functionality:References
Spec - Inheritance in Settings UI
#8804 - removes the ambiguity of leaving a setting blank
#6800 - Settings UI Epic
#8899 - Automation properties for Settings UI
#8768 - Keyboard Navigation
PR Checklist
Detailed Description of the Pull Request / Additional comments
A few highlights in this PR:
Profiles::OnNavigatedTo()
needs a property changed handler to update its own "Current" and update the UI properlyBinding
is used instead ofx:Bind
in some places becausex:Bind
can't find the parentSettingContainer
and gives you a compiler error.SettingContainer
filesOnApplyTemplate
SettingContainer
be in charge of it. This allows us to add the reset button in there.DependencyProperty
to let us set a few properties in the XML files. Particularly,Has<Setting>
andClear<Setting>
are what do all the heavy lifting of interacting with the inheritance model.Demo
Validation Steps Performed
Next Steps