You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(richtext-lexical): richtext fields don't respect RTL direction for Arabic and other RTL locales (#15964)
# Overview
Fixes RTL text direction not working in Lexical richtext fields when
using Arabic (or other RTL) locales. Text/Textarea fields worked fine —
Lexical just wasn't wired up to detect the locale direction.
## Key Changes
`Field.tsx` now calls `useLocale()` + `isFieldRTL()` and passes `rtl`
down through `LexicalProvider` → `LexicalEditor`, setting `dir="rtl"` on
the `editor-container` div when the locale is RTL.
Lexical always sets `dir="auto"` on paragraph nodes, which defaults to
LTR for empty content regardless of the parent's `dir` attribute. A CSS
rule in `LexicalEditor.scss` fixes this by forcing `direction: rtl` on
`[dir="auto"]` elements inside an RTL container.
`fieldRTL` and `fieldLocalized` in `isFieldRTL()` were typed as
`boolean` but callers already pass `boolean | undefined`. `packages/ui`
has `strict: false` so this was hidden there;
`packages/richtext-lexical` has `strict: true` and surfaced it. Made
both optional and exported `isFieldRTL` from `@payloadcms/ui` client
exports.
key={JSON.stringify({ path, rerenderProviderKey })}// makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)
0 commit comments