Skip to content

Angualr Material Table RTL #27491

Open
Open
@albahrawy

Description

@albahrawy

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

it is a small bug in css of the table.
in the _data-table-theme.scss we have

@mixin cell-padding(
  $leading-padding: $cell-leading-padding,
  $trailing-padding: $cell-trailing-padding,
  $row-checkbox-density-scale: null,
  $query: feature-targeting.all()
) {
  $feat-structure: feature-targeting.create-target($query, structure);

  .mdc-data-table__cell,
  .mdc-data-table__header-cell {
    @include feature-targeting.targets($feat-structure) {
      padding: 0 $trailing-padding 0 $leading-padding;
    }
  }
}

we are using $leading-padding and $trailing-padding for padding the cell which usually is 16px
but in the "_table-flex-styles.scss" file

`mat-cell,
mat-header-cell,
mat-footer-cell {

    // Note: we use `first-of-type`/`last-of-type` here in order to prevent extra
    // elements like ripples or badges from throwing off the layout (see #11165).
    &:first-of-type {
        padding-left: $row-horizontal-padding;

        [dir='rtl'] &:not(:only-of-type) {
            padding-left: 0;
            padding-right: $row-horizontal-padding;
        }
    }

    &:last-of-type {
        padding-right: $row-horizontal-padding;

        [dir='rtl'] &:not(:only-of-type) {
            padding-right: 0;
            padding-left: $row-horizontal-padding;
        }
    }
}`

for LTR it works fine because we set only padding-left for the first-of-type and padding-right for the last-of-type, and still get the original one in (data-table-theme.scss) which will be in my case 16 and 24 cool.

in RTL we set them equal to zero which breaks what we have in the data-table-theme.scss

Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

Expected Behavior

Actual Behavior

Environment

  • Angular:
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

Activity

crisbeto

crisbeto commented on Jul 21, 2023

@crisbeto
Member

I'm not quite sure what the bug report is about here. Is it that the padding is different between the flex and non-flex tables or that the flex tables get the extra trailing padding in RTL?

added
P4A relatively minor issue that is not relevant to core functions
needs: clarificationThe issue does not contain enough information for the team to determine if it is a real bug
and removed
needs triageThis issue needs to be triaged by the team
on Jul 26, 2023
albahrawy

albahrawy commented on Jul 28, 2023

@albahrawy
Author

image
you can see here https://stackblitz.com/edit/fqnds4?file=src%2Fexample%2Ftable-basic-example.html

it is related to flex and RTL with first-of-type & last-of-type

added
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
and removed
P4A relatively minor issue that is not relevant to core functions
needs: clarificationThe issue does not contain enough information for the team to determine if it is a real bug
on Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/table

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Angualr Material Table RTL · Issue #27491 · angular/components