Skip to content

fix(direction): preserve explicit bidiVisual=false in resolveTableDirection (SD-3141)#3283

Merged
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-3141-resolver-symmetry
May 14, 2026
Merged

fix(direction): preserve explicit bidiVisual=false in resolveTableDirection (SD-3141)#3283
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-3141-resolver-symmetry

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Small, prerequisite for SD-3138 Phase 1B.

resolveTableDirection previously emitted visualDirection only for the explicit-true case, conflating "no signal" with "explicit false." Per ECMA-376 §17.4.1 + §17.17.4, w:bidiVisual w:val="0" is an explicit-false that can override a style-cascade true. The cascade-override semantic is the same as paragraph w:bidi, which resolveParagraphDirection already handles symmetrically.

The helper getTableVisualDirection added in SD-3138 / PR #3279 already returned 'ltr' for the legacy fallback path. Without this fix, Phase 1B (pm-adapter wiring of tableDirectionContext) would silently regress an explicit-false table from 'ltr' to undefined once the context path takes over.

Diff: one else if added; four resolver tests covering the new branch + the unchanged paths.

Tests: 29 pass (24 existing direction tests + 4 new + 1 existing rtl-mixed). No behavior change for current consumers (they read === 'rtl'; 'ltr' and undefined both go to the false branch).

Sequencing: land before SD-3138 Phase 1B starts. Companion to SD-3142 (export-side fix for the same explicit-false semantic).

…ection (SD-3141)

resolveTableDirection previously emitted visualDirection only for the
explicit-true case, conflating "no signal" with "explicit false."

Per ECMA-376 section 17.4.1 + 17.17.4, w:bidiVisual w:val="0" is an
explicit-false that can override a style-cascade true. Cascade-override
semantics match paragraph w:bidi, which resolveParagraphDirection
already handles symmetrically. The table resolver had a gap.

Add the missing else-if branch so an explicit false emits
visualDirection: 'ltr'. The helper getTableVisualDirection added in
SD-3138 (PR #3279) already returned 'ltr' for the legacy fallback path;
this aligns the resolver with the helper so Phase 1B (pm-adapter wiring
of tableDirectionContext) does not silently regress the explicit-false
case from 'ltr' to undefined.

Tests:
- rightToLeft: false -> visualDirection: 'ltr'
- bidiVisual: false -> visualDirection: 'ltr'
- empty input -> visualDirection: undefined
- rtl wins when mixed signals present
- 24 existing direction tests still pass.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 14, 2026 10:33
@linear
Copy link
Copy Markdown

linear Bot commented May 14, 2026

SD-3141

@caio-pizzol caio-pizzol merged commit c6fbcf8 into main May 14, 2026
57 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-3141-resolver-symmetry branch May 14, 2026 10:40
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.91

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.134

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.136

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in superdoc v1.30.0-next.88

The release is available on GitHub release

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.

2 participants