Skip to content

fix(i18n): font family inline style overrides RTL font stack #1445

@koala73

Description

@koala73

Context

PR #1393 added a font family toggle that sets --font-body via document.documentElement.style.setProperty(). This inline style has higher specificity than the [dir="rtl"] CSS rule that sets --font-body to Arabic/Hebrew fonts.

Problem

When a user selects "System Default" font and the page is in RTL mode, the inline style wins over the CSS [dir="rtl"] rule, potentially breaking Arabic/Hebrew text rendering.

Proposed Fix

Use a data-font attribute on <html> instead of inline style:

  • applyFont() sets document.documentElement.dataset.font = 'system'
  • CSS: [data-font="system"] { --font-body: system-ui, ... }
  • [dir="rtl"] rule naturally overrides since it's more specific or later in cascade

Follow-up from PR #1393.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions