Search Issue Tracker

By Design

Votes

1

Found in

6000.0.37f1

6000.1.0b5

6000.2.0a2

Issue ID

UUM-96742

Regression

No

USS styles fail to inherit correctly when contentContainer is overridden in a custom control

-

Reproduction steps:
1. Open the attached “IN-91495.zip” project
2. Open Assets > Scripts > BugUITKInheritance.uss
3. Open Assets > Scripts > BugUITKInheritance.uxml in UI Builder
4. Observe the column on the right

Expected result: The column text color is red
Actual result: The column text color is black

Reproducible with: 6000.0.37f1, 6000.1.0b5, 6000.2.0a2
Couldn’t test with: 2022.3.57f1 (“error CS0246: The type or namespace name 'UxmlElementAttribute'“ and “error CS0246: The type or namespace name 'UxmlElement'“ errors)

Reproducible on: Windows 11
Not reproducible on: No other environment tested

  1. Resolution Note:

    This is intented. When we override the contentContainer property of a control, the contentContainer's physical children become the control's root's logical children. The logical parent of the elements under that contentContainer are now the control's root directly, and the contentContainer element is no longer part of its physical children's logical hierarchy, so its USS classes are not visible when processing the children's style.

    This behavior enforces the contentContainer abstraction, where there should be no impact to an element's styling if we insert additional elements between the control's root and its logical children. The ScrollView for example has multiple levels of hierarchy between the ScrollView's root and its logical children, but the exact details of that hierarchy shouldn't be taken into account when interacting with the ScrollView.

    In this ticket's reproduction project, the fact that one of the table's column was used as the contentContainer element means that that column's specific USS classes are not visible to the elements inside the table, because their logical parent is not the column anymore, but rather it's the table directly. However, some styles like the `color` style are inherited by nature, and because of that they are applied from the column element directly, which happens outside of the contentContainer abstraction, so in that case the color style seems to be applied to the logical children correctly. However, the color style is not applied to the logical children directly; it's just inherited.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.