angular / angular/components

mat-expansion-panel - styles get messed up if panel is a child of another element

Đang mở
#13,419 0 bình luận 16 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

area: material/expansion P4
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

Bug, feature request, or proposal:

The styles of panels will get messed up in the panels are placed in another element (ex: div)
Please see pseudo-code example below:

<mat-accordion>
  <div>
    <mat-expansion-panel>...</mat-expansion-panel>
  </div>
  <div>
    <mat-expansion-panel>...</mat-expansion-panel>
  </div>
</mat-accordion>
What is the expected behavior?

Panels should be styled correctly

What is the current behavior?

capture

What is the use-case or motivation for changing an existing behavior?

I was trying to implement draggable panels and my implementation has panels inside divs.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material 7.0.0-beta.2

Is there anything else we should know?

To fix replace lines 15-29 in expansion-panel.scss:

.mat-accordion & {
  &:not(.mat-expanded), &:not(.mat-expansion-panel-spacing) {
    border-radius: 0;
  }

  &:first-of-type {
    border-top-right-radius: $border-radius;
    border-top-left-radius: $border-radius;
  }

  &:last-of-type {
    border-bottom-right-radius: $border-radius;
    border-bottom-left-radius: $border-radius;
  }
}

... with the following:

.mat-accordion & {
  &:not(.mat-expanded), &:not(.mat-expansion-panel-spacing) {
    border-radius: 0;
  }
}

.mat-accordion > &:first-child,
.mat-accordion > &:first-child:not(.mat-expansion-panel) & {
  border-top-right-radius: $border-radius;
  border-top-left-radius: $border-radius;
}

.mat-accordion > &:last-child,
.mat-accordion > *:last-child:not(.mat-expansion-panel) & {
  border-bottom-right-radius: $border-radius;
  border-bottom-left-radius: $border-radius;
}

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong src/lib/expansion/expansion-panel.scss tại các dòng được tham chiếu 15-29 và tái tạo markup mat-expansion-panel lồng nhau với các wrapper div. So sánh việc thay thế selector được báo cáo với các style hiện có, sau đó xác minh rằng panel đầu tiên và cuối cùng vẫn giữ đúng border radius khi các panel được lồng bên trong các phần tử khác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.