spectrum-web-components icon indicating copy to clipboard operation
spectrum-web-components copied to clipboard

[Bug]: Spectrum 2 StatusLight ignores line-height custom property for CJK locales

Open poplolioi11 opened this issue 1 month ago • 3 comments

Code of conduct

  • [x] I agree to follow this project's code of conduct.

Impacted component(s)

Spectrum 2 / swc-status-light

Library version

@adobe/spectrum-wc 2.0.0-beta.5; current main 3f8f64e6cab1d3a4379459bf63eb8d81cb7e82a3

Expected behavior

The documented --swc-status-light-line-height hook should honor the consumer's 32px value for en, zh-TW, ja and ko. Uncustomized CJK should keep its intended 1.5 line-height at every size.

Actual behavior

With a 14px font, the English instance computes line-height: 32px, but zh-TW, ja and ko compute 21px despite a 32px host hook. The same failure occurs at explicit s/m/l/xl sizes (18/21/24/27px). This affects consumers customizing label spacing; no task-blocking or product-wide impact is claimed.

Current source directly sets line-height inside .swc-StatusLight:lang(...) and bypasses --_swc-status-light-line-height: https://github.com/adobe/spectrum-web-components/blob/3f8f64e6cab1d3a4379459bf63eb8d81cb7e82a3/gen2/packages/swc/components/status-light/status-light.css#L37

The hook is documented for label line height in StatusLight.ts and the migration guide. The CSS custom-property contributor guide also calls for exposing CJK-varying values and defining public overrides on :host. This concerns the custom hook, not the intentional CJK default.

Screenshots

No response

What browsers are you seeing the problem in?

Chrome

How can we reproduce this issue?

  1. Install @adobe/[email protected] and use the imports and markup below.
  2. Wait for the custom element update and inspect getComputedStyle(el.shadowRoot.querySelector('.swc-StatusLight')).lineHeight.
  3. Compare en with zh-TW, ja and ko; also repeat with omitted size and size=s/m/l/xl.
  4. The English custom value is 32px; CJK ignores it.

I reproduced this locally in the macOS in-app Chromium browser (UA Chrome/156.0.0.0), 1280x720. The fixture uses the actual StatusLight source class and official beta.5 CSS; the build checked that the published CSS sourcemap source matches current main byte-for-byte. Measurements were read from the committed shadow DOM, not hardcoded expected values.

Sample code or abstract reproduction which illustrates the problem

import '@adobe/spectrum-wc/tokens.css';
import '@adobe/spectrum-wc/swc.css';
import '@adobe/spectrum-wc/components/status-light/swc-status-light.js';
<html lang="en" class="swc-theme--sizeM swc-theme--light">
<style>
  .custom { --swc-status-light-line-height: 32px; }
</style>
<swc-status-light id="en" lang="en" class="custom">
  Document review pending approval
</swc-status-light>
<swc-status-light id="zh" lang="zh-TW" class="custom">
  這份文件正在等待審核人員確認並且回覆
</swc-status-light>
</html>

Severity

SEV 4

Logs taken while reproducing problem

Local repair experiment: remove the internal CJK line-height declaration and put its same default on :host(:lang(ja)), :host(:lang(zh)), :host(:lang(ko)) after the size rules:

:host(:lang(ja)),
:host(:lang(zh)),
:host(:lang(ko)) {
  --swc-status-light-line-height: token("cjk-line-height-100");
}

Actual browser comparison: 4 locales x 5 size states x default/custom = 40 cases. All 15 customized CJK cases changed to 32px. All 25 English/default-CJK controls retained identical computed line-height, font size and rendered height. For omitted size zh-TW, the custom three-line label changed from 21px/63px to 32px/96px. This is a local fix experiment, not a claim that the upstream suite or other browser engines passed.

Duplicate check: recorded all-state issues/PR searches for status-light + line-height/CJK. #6133 defines the intended CJK default. Merged #6620 has separate CJK and custom-hook VRT rows, but its custom line-height case has no CJK lang; I found no existing report of their interaction in those searches.

AI assistance was used for analysis and draft preparation; the behavior and repair were checked in a real local browser.

Would you like to track this issue in Jira?

  • [ ] Yes, please tell me the ticket number!

poplolioi11 avatar Oct 25 '26 07:10 poplolioi11

:x: You don't have permission to export this issue.

github-jira-sync-bot avatar Oct 25 '26 07:10 github-jira-sync-bot

@magento export issue to Jira project SWC as Bug

najikahalsema avatar Oct 26 '26 21:10 najikahalsema

:white_check_mark: Jira issue SWC-2701 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Oct 26 '26 21:10 github-jira-sync-bot