Skip to content

Fix RTL displaCy dependency labels#13981

Draft
lxingy3 wants to merge 1 commit into
explosion:masterfrom
lxingy3:fix-rtl-displacy-label-paths
Draft

Fix RTL displaCy dependency labels#13981
lxingy3 wants to merge 1 commit into
explosion:masterfrom
lxingy3:fix-rtl-displacy-label-paths

Conversation

@lxingy3

@lxingy3 lxingy3 commented Jun 17, 2026

Copy link
Copy Markdown

Description

Fixes #4854.

This updates the displaCy dependency renderer so dependency labels no longer depend on the SVG side attribute. Browser support for side is inconsistent, which makes RTL dependency labels appear reversed or upside down in Chrome and Safari.

The visible dependency arc is unchanged. The label now follows a separate invisible path, and RTL rendering reverses that label path so the text direction stays readable without relying on side.

Types of change

Bug fix.

Testing

  • python -m py_compile spacy\displacy\render.py spacy\displacy\templates.py spacy\tests\test_displacy.py
  • git diff --check
  • Focused pytest was not run because the local Python environment does not have spaCy's runtime dependencies installed (thinc is missing before test collection).

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

displaCy dependency tree labels backwards (and upside down) in RTL languages in certain browsers

1 participant