Skip to content

Fix #72: Add font size adjustment option and fix inconsistent font si...#414

Open
JiwaniZakir wants to merge 1 commit intoGCWing:mainfrom
JiwaniZakir:fix/72-add-font-size-adjustment-option-and-fix
Open

Fix #72: Add font size adjustment option and fix inconsistent font si...#414
JiwaniZakir wants to merge 1 commit intoGCWing:mainfrom
JiwaniZakir:fix/72-add-font-size-adjustment-option-and-fix

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Closes #72

Adds a font-size CSS token to the user message component and introduces unit tests for the font-preference resolution layer that backs the upcoming font-size setting.

Changes

src/web-ui/src/flow_chat/components/modern/UserMessageItem.scss

  • .user-message-item__content: added font-size: var(--flowchat-font-size-base) so message text scales with the user's font preference instead of inheriting an uncontrolled cascade value.
  • Adjusted line-height from 1.61.65 to tighten the relationship between the new variable base size and vertical rhythm.

src/web-ui/src/infrastructure/font-preference/types/fontPreference.test.ts (new file)

  • deriveFontSizeTokens: verifies the full token ladder (xs, sm, base, lg, xl, 2xl) at the default 14 px base, and confirms clamping at the 12 px floor and 20 px ceiling.
  • resolveFontSizeTokens: covers named preset levels (default), custom levels with an explicit customPx, and the fallback to 14 px when customPx is absent.
  • resolveFlowChatFontSizeTokens: tests all three flowChat.mode values — lift (UI base + 1 px, capped at 20), sync (mirrors UI tokens exactly), and independent (uses its own basePx).

Motivation

The chat window had no font-size declaration on .user-message-item__content, so message text size depended on ambient inheritance, causing visible inconsistency between messages rendered in different contexts. Binding the property to --flowchat-font-size-base makes it explicit and enables the font-size preference system (tracked in issue #72) to control it uniformly.

The test file validates the three exported functions and two constants from infrastructure/font-preference/types/index that form the core of that preference system — catching regressions in clamping logic, preset resolution, and per-context mode behavior before the settings UI lands.

Testing

Unit tests added in fontPreference.test.ts cover 8 cases across all three resolver functions. Run with:

vitest run src/web-ui/src/infrastructure/font-preference/types/fontPreference.test.ts

Manual verification: setting --flowchat-font-size-base to values between 12 px and 20 px on .user-message-item__content produces uniform, predictable text size across all messages in the chat window with consistent 1.65 line-height.


This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.

Tie user message content to --flowchat-font-size-base CSS token and
align line-height (1.65) with AI message FlowTextBlock for consistency.
Add unit tests for font-preference token derivation helpers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add font size adjustment option and fix inconsistent font size/spacing in chat window

1 participant