Skip to content

Styling of the Switch component is broken when using with ModalTrigger component #1099

Open
@sungik-choi

Description

Summary

Switch 컴포넌트를 ModalTrigger 컴포넌트로 감싸서 사용했을 경우 스타일링이 깨지는 문제(background-color 적용되지 않음)가 있습니다.

Reproduction process

asChild prop이 true인 컴포넌트를 중첩해서 사용할 경우, 하위 엘리먼트에 속성이 제대로 전달되지 않음.

Version of bezier-react

1.0.0-next-v1.180

Browser

Chrome v108.0.5359.124

Operating system

  • macOS
  • Windows
  • Linux

Additonal Information

  • Radix UI를 사용할 경우, 최대한 Root Component는 asChild 속성을 사용하지 않아야 asChild 를 사용한 다른 컴포넌트와 조합 시 문제 없이 사용할 수 있겠습니다.

Dialog Trigger

image

Switch Root

image
  • radix Dialog Trigger도 상태값을 data-state 에 담고, Switch도 마찬가지이기 때문으로 보입니다. ModalTrigger가 Switch 외부에 위치할 시 Switch의 data-state가 ModalTrigger의 것으로 오버라이드되는데, Switch의 background-color 스타일은 Switch의 data-state 값 기반 선택자로 되어있기 때문에 발생하는 문제.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugIssues related to anything that isn't workingstatus:pendingIssue or PR that is now pending

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions