Skip to content

Adjust CSS specificity to ensure Japanese font is properly applied#2776

Merged
timok1m merged 2 commits intochannel-io:mainfrom
timok1m:fix/webtech-4524
Jan 12, 2026
Merged

Adjust CSS specificity to ensure Japanese font is properly applied#2776
timok1m merged 2 commits intochannel-io:mainfrom
timok1m:fix/webtech-4524

Conversation

@timok1m
Copy link
Contributor

@timok1m timok1m commented Jan 12, 2026

Self Checklist

  • I wrote a PR title in English and added an appropriate label to the PR.
  • I wrote the commit message in English and to follow the Conventional Commits specification.
  • I added the changeset about the changes that needed to be released. (or didn't have to)
  • I wrote or updated documentation related to the changes. (or didn't have to)
  • I wrote or updated tests related to the changes. (or didn't have to)
  • I tested the changes in various browsers. (or didn't have to)
    • Windows: Chrome, Edge, (Optional) Firefox
    • macOS: Chrome, Edge, Safari, (Optional) Firefox

Related Issue

Summary

css 적용 우선순위로 인해 일본어일 때 타이포그래피 폰트의 오버라이드가 적용되지 않는 문제를 수정합니다.

Details

  • 베지어 V3 토큰을 추가하며 font-family에 대한 토큰이 사용처 별로 나뉘게 되었습니다.
  • 그에 대한 대응으로 언어가 일본어일 때 폰트를 오버라이드 하도록 수정했으나 css 특이성으로 인해 적용되지 않았습니다.
  • 기존에는 font-family를 재정의하여 오버라이드 하는 방식이었으나, font-family에 사용된 토큰을 오버라이드 해야 일본어일 때 typography-*font-family를 사용할 경우 일본어 폰트가 적용될 수 있습니다.
**AS IS (v1)**
- --font-family-sans-kr
- --font-family-sans-jp

**TO BE (v3 semantic)**
- --typography-heading-font-family: --typography-font-family-sans-kr
- --typography-text-font-family: --typography-font-family-sans-kr
- --typography-display-font-family: --typography-font-family-sans-kr

**일본어일 때 아래와 같이 오버라이드 되어야 함**
- --typography-heading-font-family: --typography-font-family-sans-jp
- --typography-text-font-family: --typography-font-family-sans-jp
- --typography-display-font-family: --typography-font-family-sans-jp

CSS 특이성(Specificity)

  • 특이성이란?
    • 여러 규칙이 같은 요소에 적용될 때 어떤 규칙이 우선되는지 결정하는 점수입니다.
  • 계산 방법
    • 특이성은 4개의 숫자로 표현됩니다: (인라인, ID, 클래스/속성/가상클래스, 요소)
  • 점수 체계:
    • 인라인 스타일 (style="..."): 1,0,0,0
    • ID 선택자 (#id): 0,1,0,0
    • 클래스/속성/가상클래스:
      • .class: 0,0,1,0
      • [data-theme]: 0,0,1,0
      • :hover, :lang(ja): 0,0,1,0
      • 요소 선택자 (div, p): 0,0,0,1
    • 예외:
      • :where(): 특이성 0,0,0,0 (항상 낮음)
      • :is(), :has(): 내부 선택자 중 가장 높은 특이성 사용
  • 비교 규칙
    • 왼쪽부터 비교합니다. 예:
      • 0,1,0,0 > 0,0,2,0 (ID가 클래스보다 우선)
      • 0,0,2,0 > 0,0,1,0 (클래스가 많을수록 높음)
/* 특이성: 0,0,1,0 (속성 선택자 1개) */
[data-bezier-theme="dark"] {
  --typography-text-font-family: var(--typography-font-family-sans-kr);
}

/* 특이성: 0,0,1,0 (가상클래스 1개) */
:lang(ja) {
  --typography-text-font-family: var(--typography-font-family-sans-jp);
}

/* 두 규칙의 특이성이 같으면 (0,0,1,0), 나중에 선언된 규칙이 우선됩니다. 하지만 레이어가 다르면 레이어 우선순위가 먼저 적용됩니다. */ 
/* 특이성: 0,1,1,0 (속성 1개 + 가상클래스 1개) */
[data-bezier-theme="dark"]:lang(ja) {
  --typography-text-font-family: var(--typography-font-family-sans-jp);
}

- css 특이성은 여러가지 항목과 예외 케이스에 의해 결정됩니다. 
- 이번 문제 상황에서는 `:lang(ja)`에서 설정한 토큰 오버라이드보다 `[data-bezier-theme="dark"]`가 들고 있는 토큰이 우선순위가 높아서 오버라이드가 의도한대로 동작하지 않았습니다.
- 따라서 `[data-bezier-theme="dark"]:lang(ja)`를 통해 특이성을 높이는 방식으로 문제를 해결합니다.

Breaking change? (Yes/No)

No

References

@timok1m timok1m requested a review from wes5510 January 12, 2026 02:34
@timok1m timok1m self-assigned this Jan 12, 2026
@timok1m timok1m added the bug Issues related to anything that isn't working label Jan 12, 2026
@channeltalk
Copy link

channeltalk bot commented Jan 12, 2026

@changeset-bot
Copy link

changeset-bot bot commented Jan 12, 2026

🦋 Changeset detected

Latest commit: ed9e508

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@channel.io/bezier-react Patch
bezier-figma-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

개요

@channel.io/bezier-react의 패치 릴리스를 위한 변경 세트 파일이 추가되었으며, 일본어 폰트가 올바르게 적용되도록 CSS 특이성이 조정되었습니다. 조건부 언어 선택자의 범위가 전역에서 테마 스코프로 축소되었습니다.

변경 사항

코호트 / 파일(들) 변경 요약
변경 세트
\.changeset/polite-pants-pump\.md
패치 릴리스 변경 세트 파일 추가
스타일
packages/bezier-react/src/styles/_base\.scss
:lang(ja) 선택자를 [data-bezier-theme='dark']:lang(ja), [data-bezier-theme='light']:lang(ja)로 변경하여 테마 속성이 있을 때만 일본어 폰트를 적용하도록 CSS 특이성 조정

예상 코드 리뷰 난이도

🎯 2 (Simple) | ⏱️ ~12 분

🐰 변경 세트와 함께, 스타일 향상하네요
일본어 폰트는 이제 테마 안에서만 춤을 춘답니다
특이성 조정으로 모든 게 제대로 맞춰졌어요
작은 변화, 큰 의미! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경사항(CSS 특이성 조정을 통한 일본어 폰트 적용)을 명확하게 요약하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed PR description는 템플릿의 모든 필수 섹션을 포함하고 있으며, 상세한 설명과 구체적인 예시를 제공합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.80%. Comparing base (84ed149) to head (ed9e508).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2776   +/-   ##
=======================================
  Coverage   81.80%   81.80%           
=======================================
  Files         149      149           
  Lines        2957     2957           
  Branches      928      934    +6     
=======================================
  Hits         2419     2419           
- Misses        504      534   +30     
+ Partials       34        4   -30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

Chromatic Report

🚀 Congratulations! Your build was successful!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/bezier-react/src/styles/_base.scss (1)

18-23: CSS 명시도 수정이 적절합니다.

테마 속성 셀렉터와 :lang(ja)를 결합하여 명시도를 (0,2,0)으로 높이는 방식은 명시도 충돌 문제를 해결하는 올바른 접근입니다. 다만 이 변경으로 인해 data-bezier-theme 속성 없이는 JP 폰트 오버라이드가 적용되지 않습니다. 표준 사용 패턴인 AppProvider 사용 시에는 항상 속성이 설정되므로 문제없지만, AppProvider 없이 컴포넌트를 사용하는 엣지 케이스가 있는지 검토하세요.

선택 사항: :is() 셀렉터로 중복을 줄일 수 있습니다:

-[data-bezier-theme='dark']:lang(ja),
-[data-bezier-theme='light']:lang(ja) {
+:is([data-bezier-theme='dark'], [data-bezier-theme='light']):lang(ja) {
   --typography-heading-font-family: var(--typography-font-family-sans-jp);
   --typography-text-font-family: var(--typography-font-family-sans-jp);
   --typography-display-font-family: var(--typography-font-family-sans-jp);
 }

명시도는 동일하게 유지됩니다.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84ed149 and ed9e508.

📒 Files selected for processing (2)
  • .changeset/polite-pants-pump.md
  • packages/bezier-react/src/styles/_base.scss
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Chromatic
🔇 Additional comments (1)
.changeset/polite-pants-pump.md (1)

1-5: LGTM!

버그 수정에 대한 patch 버전 범프가 적절하며, 변경 사항 설명이 명확합니다.

@timok1m timok1m merged commit b86f108 into channel-io:main Jan 12, 2026
8 of 9 checks passed
timok1m pushed a commit that referenced this pull request Jan 12, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @channel.io/bezier-react@3.6.1

### Patch Changes

- Adjust CSS specificity to ensure Japanese font is properly applied.
([#2776](#2776)) by
@timok1m

## bezier-figma-plugin@0.7.20

### Patch Changes

-   Updated dependencies
    -   @channel.io/bezier-react@3.6.1


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## 릴리스 노트

* **Chores**
  * bezier-react가 3.6.1로 업데이트됨
  * bezier-figma-plugin이 0.7.20으로 업데이트됨
  * 최신 의존성이 반영됨

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
timok1m added a commit that referenced this pull request Jan 12, 2026
…specify font family explicitly (#2778)

<!--
  How to write a good PR title:
- Follow [the Conventional Commits
specification](https://www.conventionalcommits.org/en/v1.0.0/).
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

## Self Checklist

- [x] I wrote a PR title in **English** and added an appropriate
**label** to the PR.
- [x] I wrote the commit message in **English** and to follow [**the
Conventional Commits
specification**](https://www.conventionalcommits.org/en/v1.0.0/).
- [x] I [added the
**changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md)
about the changes that needed to be released. (or didn't have to)
- [x] I wrote or updated **documentation** related to the changes. (or
didn't have to)
- [x] I wrote or updated **tests** related to the changes. (or didn't
have to)
- [ ] I tested the changes in various browsers. (or didn't have to)
  - Windows: Chrome, Edge, (Optional) Firefox
  - macOS: Chrome, Edge, Safari, (Optional) Firefox

## Related Issue
- #2776
<!-- Please link to issue if one exists -->

<!-- Fixes #0000 -->

## Summary

<!-- Please brief explanation of the changes made -->
css 적용 우선순위로 인해 일본어일 때 타이포그래피 폰트의 오버라이드가 적용되지 않는 문제를 재수정합니다.

## Details

<!-- Please elaborate description of the changes -->
- 현재 css 레이어 우선순위는 tokens > base > components 로 설정되어 있습니다.
- 토큰을 오버라이드 했던 기존 코드는 base 레이어에서 정의되어 있습니다.
- 토큰의 우선순위 상 tokens가 base보다 우선하기 때문에 해당 코드는 동작하지 않았습니다.
- [최초
코드](https://github.com/channel-io/bezier-react/pull/2764/changes#diff-d5343edd2cbd4060cb12d851b2ce7b8776194248a36fa05f6a4bf7c9dff9cfdfL19-R22)와
같이 font-family를 명시적으로 설정하는 방향으로 문제를 해결합니다.

### Breaking change? (Yes/No)

<!-- If Yes, please describe the impact and migration path for users -->
No
## References

<!-- Please list any other resources or points the reviewer should be
aware of -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## 릴리스 노트

* **버그 수정**
  * Japanese 폰트가 제대로 적용되도록 CSS 우선순위를 조정했습니다.
  * 기본 폰트 가족 설정을 개선하여 다언어 폰트 처리를 최적화했습니다.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
timok1m added a commit that referenced this pull request Jan 12, 2026
…revert to 3.6.1 approach (#2780)

<!--
  How to write a good PR title:
- Follow [the Conventional Commits
specification](https://www.conventionalcommits.org/en/v1.0.0/).
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

## Self Checklist

- [x] I wrote a PR title in **English** and added an appropriate
**label** to the PR.
- [x] I wrote the commit message in **English** and to follow [**the
Conventional Commits
specification**](https://www.conventionalcommits.org/en/v1.0.0/).
- [x] I [added the
**changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md)
about the changes that needed to be released. (or didn't have to)
- [x] I wrote or updated **documentation** related to the changes. (or
didn't have to)
- [x] I wrote or updated **tests** related to the changes. (or didn't
have to)
- [ ] I tested the changes in various browsers. (or didn't have to)
  - Windows: Chrome, Edge, (Optional) Firefox
  - macOS: Chrome, Edge, Safari, (Optional) Firefox

## Related Issue

<!-- Please link to issue if one exists -->
- #2778
- #2776
<!-- Fixes #0000 -->

## Summary

<!-- Please brief explanation of the changes made -->
css 적용 우선순위로 인해 일본어일 때 타이포그래피 폰트의 오버라이드가 적용되지 않는 문제를 재수정하여 최종 적용합니다.
## Details

<!-- Please elaborate description of the changes -->
- #2776 에서 적용했던 방식이 유효한
방법이었음을 확인했습니다.
- 해당 방식이 동작하지 않았던 것은 베지어 패키지 외부(베지어를 사용하던 어플리케이션)의 문제였음을 확인했습니다.
- 처음 적용했던 방식으로 다시 회귀하고, css 선택자를 보다 간결하게 유지하여 마무리합니다.

### Breaking change? (Yes/No)

<!-- If Yes, please describe the impact and migration path for users -->
No
## References

<!-- Please list any other resources or points the reviewer should be
aware of -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## 버그 수정

* 일본어 폰트 표시를 위한 CSS 특이성 조정
* 폰트 변수 체계 개선 (제목, 본문, 디스플레이 폰트 분리)
* 코드 블록 폰트 변수 최적화

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues related to anything that isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments