Skip to content

View.GetAttributeForRole should defer to SuperView.GetAttributeForRole instead of using GetScheme #4177

Open
@tig

Description

@tig

Current code:

    public Attribute GetAttributeForRole (VisualRole role)
    {
        Attribute schemeAttribute = GetScheme ()!.GetAttributeForRole (role);
...

Proposed code:

    public Attribute GetAttributeForRole (VisualRole role)
    {
        Attribute roleAttribute = SuperView?.GetAttributeForRole (role) ?? GetScheme ()!.GetAttributeForRole (role);
...

Why is the current code broken? And why is the Proposed code better?

If a subview of some view overrides the behavior using OnGettingAttributeForRole/GettingAttributeForRole, the existing code calls GetScheme, which goes all the way up the heirarchy getting the Scheme, not allowing "some view" to change the subviews behavior.

For example, here "some view" is the OptionSelectors Frame which inverts Normal/HotNormal and Focus/HotFocus. Note how the label and OptionSelectors are not inverted:

Image

With the new code, this is fixed:

Image

I'm filing this as a new issue because it breaks a bunch of other stuff (e.g. note how the Border is not honoring the inversion either) and will require some more deeper work.

I'll probably create new PR for this that's independent of #4126 where I really need this fixed so that I can more easily test things.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions