Skip to content

fix: unlock font-size field for global editing without selection - #876

Open
JoeJoeflyn wants to merge 1 commit into
mayocream:mainfrom
JoeJoeflyn:fix/global-font-size-control
Open

fix: unlock font-size field for global editing without selection#876
JoeJoeflyn wants to merge 1 commit into
mayocream:mainfrom
JoeJoeflyn:fix/global-font-size-control

Conversation

@JoeJoeflyn

@JoeJoeflyn JoeJoeflyn commented Jul 26, 2026

Copy link
Copy Markdown

The font-size input, increment, and decrement buttons were disabled unless a text node was selected. This blocked the global workflow: typing a value with nothing selected should apply to every text box on the page, and clearing it should reset all boxes to auto.

What changed: The disabled guard now checks hasNodes instead of selectedNode, so the controls stay enabled whenever the page has text boxes. Commits route through applyStyleToSelected when a node is selected and applyStyleToAll otherwise, preserving the existing per-node behavior. A local state buffer (globalFontSizeInput) holds the input value in global scope, otherwise the controlled value resets to '' on each keystroke because currentFontSize stays undefined with no selection.

User-visible behavior differences: With no text node selected, the font-size field is now editable (previously greyed out). Typing a number applies it to every text box on the page; clearing the field resets all boxes to auto. Selecting a single text box still applies changes only to that node, unchanged.

How I verified: bun run format and bun run test:ui (158/158 passed, including new tests covering the global behavior). Manually confirmed against a running app: with no text node selected, typing 24 sets fontSize=24 on all 8 text boxes; clearing the field reverts all to auto (null) in the backend scene.

Fixes: #649

This patch was made with AI assistance (Devin/Claude). The code was reviewed and tested before submission.

screenrecording-2026-07-27_00-50-21.mp4

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your first PR to Koharu.

Please review our contribution guide before review:
https://koharu.rs/contribute/introduction/

In the PR description, include:

  • what changed
  • any user-visible behavior differences
  • how you verified the change

If AI helped produce the patch, a human still needs to review and understand it before submission.

The font-size input, increment, and decrement buttons were disabled
unless a text node was selected, blocking the global workflow: typing
a value with nothing selected should apply to every text box on the
page, and clearing it should reset all boxes to auto.

What changed:
- Switch the disabled guard from !selectedNode to !hasNodes so the
  controls stay enabled whenever the page has text boxes.
- Route commits through applyStyleToSelected when a node is selected
  and applyStyleToAll otherwise, so the existing per-node behavior is
  preserved.
- Buffer the input in local state (globalFontSizeInput) while in
  global scope, otherwise the controlled value resets to '' on each
  keystroke because currentFontSize stays undefined with no selection.

User-visible behavior differences:
- With no text node selected, the font-size field is now editable
  (previously greyed out). Typing a number applies it to every text
  box on the page; clearing the field resets all boxes to auto.
- Selecting a single text box still applies changes only to that
  node, unchanged.

How I verified:
- bun run format and bun run test:ui (158/158 passed, including new
  tests covering the global behavior).
- Manually confirmed against a running app: with no text node
  selected, typing 24 sets fontSize=24 on all 8 text boxes; clearing
  the field reverts all to auto (null) in the backend scene.

Closes mayocream#649.

This patch was made with AI assistance (Devin/Claude). The code was
reviewed and tested before submission.
@JoeJoeflyn
JoeJoeflyn force-pushed the fix/global-font-size-control branch from c829991 to 33eb784 Compare July 26, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Enable global font size override from "Auto" across all images

1 participant