Closed Bug 1721952 Opened 3 years ago Closed 3 years ago

RTL Text Pasted into Wordpress Visual Editor Renders LTR

Categories

(Core :: DOM: Core & HTML, defect, P2)

Firefox 91
defect

Tracking

()

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: brian, Assigned: emilio)

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

  1. Edit a new post or page in the Wordpress visual editor (Gutenberg)
  2. Add a new paragraph block in the post or page
  3. Paste Hebrew text from https://blueletterbible.org into the paragraph block

Actual results:

Pasted Hebrew text displays backwards (LTR)

NOTE - When the post or page is previewed or published the Hebrew text renders correctly.

Also, the Hebrew rendering can be corrected by entering the HTML editing mode of the Gutenberg editor and putting explicit <rtl></rtl> tags around the Hebrew text. What is REALLY weird is that this corrects the RTL display of not only that particular block of Hebrew text, but also for every other block of Hebrew text on the page or post.

Expected results:

Hebrew text should have displayed correctly (RTL)

I tested with MS Edge, and the Gutenberg visual editor displays pasted RTL text correctly.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Editor' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Editor
Product: Firefox → Core

I can reproduce this and I guess bidi is not enabled properly. I tried adding direction:rtl at a random element outside of the editor and doing so suddenly fixed the issue.

Emilio, do you see what's happening here?

Flags: needinfo?(emilio)

Copy this for your convenience: בְּרֵאשִׁית בָּרָא אֱלֹהִים אֵת הַשָּׁמַיִם וְאֵת הָאָֽרֶץ׃

Assignee: nobody → emilio
Status: UNCONFIRMED → ASSIGNED
Component: DOM: Editor → DOM: Core & HTML
Ever confirmed: true

That's exactly right. We stop properly updating CharacterData::mText.mState.mIsBidi once bidi is enabled in a document, but then if it gets adopted into a document which is not bidi-enabled we fail to enable bidi.

direction: rtl "fixes" it because it force-enables bidi here.

Now without it being cropped, whoops

Attachment #9237785 - Attachment is obsolete: true

It's not a sound optimization in presence of adoption.

Flags: needinfo?(emilio)
Severity: -- → S3
Priority: -- → P2
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/30172 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: