Skip to content

fix(richtext-lexical): preserve logical text alignment - #17809

Open
ertugakmann wants to merge 1 commit into
payloadcms:mainfrom
ertugakmann:fix/lexical-logical-text-align
Open

fix(richtext-lexical): preserve logical text alignment#17809
ertugakmann wants to merge 1 commit into
payloadcms:mainfrom
ertugakmann:fix/lexical-logical-text-align

Conversation

@ertugakmann

@ertugakmann ertugakmann commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

What?

Preserve Lexical's logical text alignment values when converting to HTML.

Before: <p style="text-align: left;">Hello</p>

After: <p style="text-align: start;">Hello</p>

Explicit left alignment is also now preserved instead of being omitted.

Why?

start and end are logical CSS alignment values and should not be converted to physical left and right values. Converting them can cause incorrect alignment for RTL content.

How?

The Lexical → HTML converter now preserves the explicit alignment value instead of resolving start/end to physical values.

Added regression tests covering start, end, explicit left/right, and RTL direction.

Tests:

  • pnpm vitest run packages/richtext-lexical/src/features/converters/lexicalToHtml/sync/alignment.spec.ts
  • 5/5 passing

Fixes #17784

@ertugakmann

Copy link
Copy Markdown
Contributor Author

The PR's alignment regression tests pass (5/5).

The CI failures appear unrelated to this change. The failing jobs are integration tests in unrelated areas:

  • MongoDB: collections-graphqlpayload is undefined during teardown.
  • MongoDB: locked-documentsMongoServerError: Unable to write to collection 'payload._pages_versions' due to catalog changes.
  • PostgreSQL read replica: postgres-vector — expected 2 results but received 0.

The only production change in this PR is the Lexical HTML alignment conversion in findConverterForNode.ts, with a focused regression test covering the reported behavior.

No changes were made to the unrelated failing tests or CI configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[richtext-lexical] start and end text alignment are converted to left and right, breaking RTL

1 participant