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

bug(SORT): Not possible to style sorting component #28842

Open
1 task
timneil opened this issue Apr 8, 2024 · 3 comments
Open
1 task

bug(SORT): Not possible to style sorting component #28842

timneil opened this issue Apr 8, 2024 · 3 comments
Labels
area: material/sort area: material/table P4 A relatively minor issue that is not relevant to core functions

Comments

@timneil
Copy link

timneil commented Apr 8, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

The table component allows for styling of columns of data. There is an example of doing so in the documentation. https://material.angular.io/components/table/overview#styling-columns

However if you add the Sort component the headers do not have the table's\host component's styles applied.

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-idfyon?file=src%2Fapp%2Ftable-example%2Ftable-example.component.css

Expected Behavior

With component encapsulation set to emulate the Sort component elements do not recieve the host components attribute (ie. ng-tns-c1137168538). The text for the clickable sortable header should be projected content so it gains the styles of the host component while still being clickable\sortable.

Actual Behavior

Header text does not have styles.

Environment

  • Angular: 17
  • CDK/Material: 17
  • Browser(s): All
  • Operating System (e.g. Windows, macOS, Ubuntu): n/a
@timneil timneil added the needs triage This issue needs to be triaged by the team label Apr 8, 2024
@amysorto
Copy link
Contributor

You can have a more specific selector to target the header cells:

.mat-mdc-table th.mat-mdc-header-cell {
  color: pink;
}

@timneil
Copy link
Author

timneil commented Apr 11, 2024

In the example in Stackblitz the sortable headers are pink when they should be the color within the table-example.component.css.

The example is showing how the sortable component does not take on the host component styles. This is the problem I am highlighting.

None of the headers should be pink.

@amysorto
Copy link
Contributor

Ahh yes, thanks for the clarification. I will reopen this issue!

@amysorto amysorto reopened this Apr 11, 2024
@amysorto amysorto added P4 A relatively minor issue that is not relevant to core functions area: material/sort area: material/table and removed needs triage This issue needs to be triaged by the team labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/sort area: material/table P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

2 participants