Skip justify-self: flex-end on RTL table inside RTL container#3345
Open
JiuqingSong wants to merge 2 commits into
Open
Skip justify-self: flex-end on RTL table inside RTL container#3345JiuqingSong wants to merge 2 commits into
JiuqingSong wants to merge 2 commits into
Conversation
An RTL <table> currently always renders with `justify-self: flex-end` to push it to the right edge of an LTR parent. When the parent context is already RTL (e.g. an RTL table cell, an RTL <div>/<blockquote>, or an RTL list item) the table is already aligned correctly by RTL flow, so the extra `justify-self` causes visual misalignment. Propagate the current block's direction into context.implicitFormat from handleTable (cell children), handleFormatContainer, and handleListItem. The direction format handler now skips `justify-self: flex-end` when context.implicitFormat.direction is `rtl`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<table>currently always emitsjustify-self: flex-endto align it to the right edge of an LTR parent. When the parent context is already RTL, the table aligns correctly via RTL flow and the extrajustify-selfcauses visual misalignment.directionFormatHandlernow readscontext.implicitFormat.directionand skipsjustify-self: flex-endwhen the parent context is already RTL.handleTable(cell children),handleFormatContainer, andhandleListItemnow push the block'sdirectionintocontext.implicitFormatviastackFormat, so descendants can see the inherited RTL context.Test plan
yarn test:fast(fullroosterjs-content-model-domsuite: 2199 passing, +11 new tests)yarn eslintyarn bendToEndTest.ts: LTR table under RTL table, RTL table under LTR table, RTL table under RTL table — all assert the expectedjustify-selfpresence/absencedirectionFormatHandlerTest.ts,handleTableTest.ts,handleFormatContainerTest.ts,handleListItemTest.tsverifying direction propagation throughimplicitFormatand its restoration afterstackFormat🤖 Generated with Claude Code