learningequality / learningequality/studio

[RTE] Unify how the TipTap editor determines RTL

Open
#6,114 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

The TipTap editor resolves the page direction four different ways, so an RTL fix applied to one control does not carry to the others. Reduce them to a single source.

Complexity: Low
Target branch: unstable

Context
  • TipTapEditor/composables/useRovingTabIndex.js reads window.isRTL.
  • TipTapEditor/components/toolbar/ToolbarButton.vue reads document.dir or <html dir>.
  • TipTapEditor/composables/useLinkHandling.js reads document.dir.
  • TipTapEditor/components/image/ImageNodeView.vue walks up from the editor DOM to the nearest [dir="rtl"].
  • Studio sets window.isRTL in templates/base.html and re-exposes it as Vue.prototype.$isRTL in shared/i18n/setup.js.
The Change
  • Every JavaScript RTL check under shared/views/TipTapEditor/ should resolve from one source.
  • ImageNodeView's ancestor walk is the only one that can report a direction differing from the page's; whether that difference is worth keeping is part of this task.
Out of Scope
  • RTL reads elsewhere in Studio.
  • [dir='rtl'] CSS selectors, which RTLCSS handles.
Acceptance Criteria
  • Every JavaScript RTL check under shared/views/TipTapEditor/ reads from one source
  • In RTL, toolbar icons still flip, the link popover still anchors on the correct side, image resize handles still track the drag direction, and toolbar arrow keys still move in reverse
  • Jest tests that exercise RTL set the direction through that single source
References

AI usage

Claude Code drafted this issue from a review comment on #6108. It grepped shared/views/TipTapEditor/ for the direction checks and listed the four call sites it found; the acceptance criteria were reviewed against those call sites before filing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the RTL checks in shared/views/TipTapEditor/composables/useRovingTabIndex.js, useLinkHandling.js, components/toolbar/ToolbarButton.vue, and components/image/ImageNodeView.vue with window.isRTL and Vue.prototype.$isRTL in templates/base.html and shared/i18n/setup.js. Run the relevant Jest RTL tests and confirm that all four behaviors use one direction source and still satisfy the listed acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, internationalization
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.