Skip to content

fix(editor): place node text in Firefox where Chrome places it - #463

Merged
AndyScherzinger merged 1 commit into
mainfrom
fix/firefox-text-position
Oct 27, 2026
Merged

AndyScherzinger merged 1 commit into
mainfrom
fix/firefox-text-position

Conversation

@AndyScherzinger

Copy link
Copy Markdown
Member

In Firefox, the text of mind map nodes sat too high in its box. This places it exactly where Chrome does. Based on the report in #259 (thanks @stephancordes); the fix is different from the one there.

Cause. kityminder-core nudges each node's text up or down by a fraction of the font size, taken from a table per browser, operating system and font that was measured around 2014 (FONT_ADJUST in vendor/kityminder-core). Current Firefox lays out the text (dominant-baseline: text-before-edge) the same way Chrome does, but still used its own old values:

Chrome Firefox (before)
Linux, default font 0 −0.16 em → text about a sixth of a line too high
macOS, default font 0 +0.05 em
Windows, Arial −0.02 em −0.17 em → a few pixels too high
Windows, default font −0.15 em −0.16 em (no visible difference)

Fix. Firefox now uses Chrome's values: one condition in kityminder.core.js and the same in kityminder.core.min.js, which the editor loads.

#259 instead dropped every dy attribute on SVG text in Firefox. Node labels don't use dy in Firefox at all (only priority numbers and resource tags do, and those were already centred), so that would not have moved the labels.

Checked by rendering the same map in headless Firefox 158 and Chrome on Windows, before and after: default font, Arial, Times New Roman, Comic Sans and Impact nodes, priorities and resource tags now sit at the same height in both browsers. With the platform reported as Linux, the patched Firefox output is identical to Chrome's. Still to check on a real Linux machine with Firefox, plus a quick look on macOS. Exports (PNG, SVG, PDF) reuse the same text, so they follow along.

The 0.1.x backport follows in a separate PR; the vendored file is identical there.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

The mind map nudges each node's text up or down by a fraction of the
font size, taken from a table per browser and operating system that
was measured years ago. Current Firefox lays out the text like Chrome,
but still used its own outdated values: on Linux the text sat about a
sixth of a line too high, and on Windows text in Arial or Times New
Roman sat a few pixels too high.

Firefox now uses Chrome's values, so text is placed the same in both
browsers. Exports to PNG, SVG and PDF reuse the same text and follow
along.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger AndyScherzinger added this to the v0.2.0 milestone Oct 27, 2026
@AndyScherzinger AndyScherzinger added bug Something isn't working AI assisted This PR contains AI-assisted commits 3. to review browser: firefox labels Oct 27, 2026
@AndyScherzinger
AndyScherzinger merged commit 65ccbb7 into main Oct 27, 2026
8 checks passed
@AndyScherzinger
AndyScherzinger deleted the fix/firefox-text-position branch October 27, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review AI assisted This PR contains AI-assisted commits browser: firefox bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant