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).
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
-
Create a new Slidev project (e.g.
npm create slidev@latestor https://sli.dev/new). -
In
slides.md(or the first slide), set RTL, for example:--- htmlAttrs: dir: rtl lang: he --- -
Open the integrated Slidev editor.
-
On a line with Hebrew text, press
Ctrl+Left Shiftto switch to LTR. -
Start typing English text (or a mix of Hebrew and English).
-
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)
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
i have raised a pr on the issue please do have a look @geraw @kermanx