Skip to content

In the integrated Slidev editor, when working on a right-to-left (RTL) document, pressing Ctrl + Left Shift (Windows RTL/LTR keyboard shortcut) does **not** correctly switch the paragraph / typing direction to left-to-right (LTR). #2382

@geraw

Description

@geraw

Describe the bug

In the integrated Slidev editor, when working on a right-to-left (RTL) document, pressing Ctrl + Left Shift (Windows RTL/LTR keyboard shortcut) does not correctly switch the paragraph / typing direction to left-to-right (LTR).

  • The editor seems to switch to LTR mode (caret movement / typing direction change),

  • but the text itself is not displayed properly:

    • characters appear in the wrong visual order, or
    • mixed Hebrew/English text is rendered with broken bidi layout, or
    • the caret position does not match the visual position of the characters.

This happens only in the integrated editor when the document is configured as RTL (e.g. htmlAttrs: { dir: rtl }). It makes it very hard to edit LTR text (code, formulas, English phrases) inside an RTL presentation.

Expected behavior

When pressing Ctrl + Left Shift in an RTL document:

  • The editor should properly switch the current line/paragraph to LTR mode.
  • Text should be rendered with correct LTR visual order.
  • Caret movement and selection should match the displayed text.

In short, the integrated editor should respect OS bidi / direction shortcuts and render the text accordingly.


Minimal reproduction

  1. Create a new Slidev project (e.g. npm create slidev@latest or https://sli.dev/new).

  2. In slides.md (or the first slide), set RTL, for example:

    ---
    htmlAttrs:
      dir: rtl
      lang: he
    ---
  3. Open the integrated Slidev editor.

  4. On a line with Hebrew text, press Ctrl + Left Shift to switch to LTR.

  5. Start typing English text (or a mix of Hebrew and English).

  6. Observe that:

    • The editor claims to be LTR, but
    • the text rendering / character order / caret position is incorrect.

Environment

  • Slidev version: v52.4.0
  • Browser: Chrome
  • OS: Windows 10 (Hebrew layout)
  • Editing context: Integrated editor (not an external editor like VS Code)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions