Files
ComfyUI_frontend/apps/website/src/components/common/NodeBadge.vue
Yourz 7ddf71d91b fix(website): center GitHubStarBadge text in Safari (#12138)
*PR Created by the Glary-Bot Agent*

---

## Summary

The 10px star count text inside the desktop nav GitHub star badge
rendered vertically off-center in Safari/WebKit. The text was visibly
shifted upward inside the yellow badge body, while Chromium rendered it
centered correctly.

## Root cause

`NodeBadge.vue` centers its inner text span by setting `flex
items-center justify-center` on the segment, then nudging the text with
`translate-y-1` (or `translate-y-0` for the small variant). The text
span itself is an `inline-block` with no explicit `line-height`, so it
inherits the default `line-height: 1.5` (15px for a 10px font).

Safari and Chromium distribute that extra leading differently for the
`PP Formula Narrow` custom font: Safari pushes the glyph higher inside
its 15px line box, while Chromium positions it near the middle. With
only a 5px gap above/below the glyph to play with, that browser-specific
divergence is enough to make the badge look misaligned in Safari.

## Fix

Add `leading-none` to the star count text class so the inline-block's
line box equals the font size (10px) and the parent flex container's
`items-center` produces deterministic vertical centering across
browsers.

Verified at lg breakpoint (1440×900) in both WebKit and Chromium via
Playwright; the badge now renders identically and is properly centered.

## Verification

- `pnpm typecheck` (website) — clean
- `pnpm build` (website) — 51 pages built successfully
- Pre-commit hooks (stylelint, oxfmt, oxlint, eslint, typecheck,
typecheck:website) — all passed
- Visual inspection in WebKit and Chromium via Playwright

Fixes FE-648

## Screenshots

![BEFORE (Safari/WebKit): star count text displaced upward in yellow
badge](https://pub-1fd11710d4c8405b948c9edc4287a3f2.r2.dev/sessions/364b285ccc004b7d3778b6129dab4410e0bffe9db5ef124e37443414f9790d70/pr-images/1778513564903-c047c9ac-4719-479e-8442-f15ad389be02.png)

![AFTER (Safari/WebKit): star count text properly centered in yellow
badge](https://pub-1fd11710d4c8405b948c9edc4287a3f2.r2.dev/sessions/364b285ccc004b7d3778b6129dab4410e0bffe9db5ef124e37443414f9790d70/pr-images/1778513565238-a4f00af8-54d7-4131-a5fd-849105e427d6.png)

![Zoomed Safari/WebKit view showing the fixed badge with centered 85K
text](https://pub-1fd11710d4c8405b948c9edc4287a3f2.r2.dev/sessions/364b285ccc004b7d3778b6129dab4410e0bffe9db5ef124e37443414f9790d70/pr-images/1778513565587-f6aca193-5ced-45aa-b692-3340629f64be.png)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-12138-fix-website-center-GitHubStarBadge-text-in-Safari-35d6d73d3650818aa0e8e0f341b60378)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
2026-05-12 00:38:49 +00:00

80 lines
1.8 KiB
Vue

<script setup lang="ts">
import { cn } from '@comfyorg/tailwind-utils'
const {
segments,
segmentClass = 'px-6',
textClass = 'text-2xl sm:text-3xl lg:text-5xl',
sizeClass = ''
} = defineProps<{
segments: Array<{ text?: string; logoSrc?: string; logoAlt?: string }>
segmentClass?: string
textClass?: string
sizeClass?: string
}>()
</script>
<template>
<div
:class="
cn(
'font-formula-narrow flex h-11 items-stretch font-semibold **:select-none sm:h-auto',
sizeClass
)
"
>
<img
src="/icons/node-left.svg"
alt=""
class="-mx-px h-full w-auto self-stretch"
aria-hidden="true"
/>
<template
v-for="(segment, i) in segments"
:key="segment.text || segment.logoSrc || i"
>
<img
v-if="i > 0"
src="/icons/node-union.svg"
alt=""
class="-mx-px h-full w-auto self-stretch"
aria-hidden="true"
/>
<span
:class="
cn(
'bg-primary-comfy-yellow text-primary-comfy-ink flex items-center justify-center py-1.5 transition-all duration-300 sm:py-3 lg:py-5',
segmentClass
)
"
>
<img
v-if="segment.logoSrc"
:src="segment.logoSrc"
:alt="segment.logoAlt ?? ''"
class="inline-block h-5 brightness-0 transition-all duration-300 sm:h-7 lg:h-10"
/>
<span
v-else
:class="
cn(
'inline-block translate-y-1 font-bold whitespace-nowrap transition-all duration-300',
textClass
)
"
>
{{ segment.text }}
</span>
</span>
</template>
<img
src="/icons/node-right.svg"
alt=""
class="-mx-px h-full w-auto self-stretch"
aria-hidden="true"
/>
</div>
</template>