slidev icon indicating copy to clipboard operation
slidev copied to clipboard

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).

Open geraw opened this issue 1 month ago • 2 comments

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)

geraw avatar Nov 24 '25 09:11 geraw

Hi, I want to help fix the RTL/LTR issue in the integrated Slidev editor. In RTL mode, pressing Ctrl + Left Shift switches to LTR, but the text order and caret position are still wrong. Can you please assign me this issue @geraw @kermanx

CodyBrat avatar Nov 24 '25 12:11 CodyBrat

i have raised a pr on the issue please do have a look @geraw @kermanx

CodyBrat avatar Nov 27 '25 06:11 CodyBrat