Skip to content

Bidi text rendering issue with inline bold spans in RTL content #7288

Open

Description

@ahmedrowaihi

Summary

Bidirectional text with inline <span> elements (especially with bold styling) doesn't render correctly in RTL (right-to-left) contexts.

Steps to reproduce

  1. Open bidi-css-reproduction.html in Ladybird
  2. Compare with Chrome/Firefox/Safari

Expected behavior

Arabic text with bold spans should maintain proper RTL flow. Bold text should not break word order or text direction.

Actual behavior

Text direction and word order appear incorrect when bold spans are used within RTL content.

Example

<div dir="rtl" lang="ar">
  نشارك معك تقييمك الدوري مقدماً من مديرك المباشر 
  <span class="bold">خالد المطيري</span>. 
  لأدائك كـ<span class="bold">مصممة تجربة مستخدم</span> 
  في <span class="bold">فريق التصميم</span> خلال الربع الأول 2025
</div>

Test file

See bidi-css-reproduction.html for multiple test cases.

Browser versions

  • Ladybird: built from source-code | commit hash is 865b2b8
  • Chrome: [works correctly]
  • Firefox: [works correctly]
  • Safari: [works correctly]

Operating system

macOS

Steps to reproduce

  1. Open bidi-css-reproduction.html in Ladybird
  2. Compare with Chrome/Firefox/Safari

Expected behavior

Arabic text with bold spans should maintain proper RTL flow. Bold text should not break word order or text direction.

Actual behavior

Text direction and word order appear incorrect when bold spans are used within RTL content.

URL for a reduced test case

https://jsfiddle.net/s2t56u0g/

HTML/SVG/etc. source for a reduced test case

<div dir="rtl" lang="ar">
  نشارك معك تقييمك الدوري مقدماً من مديرك المباشر 
  <span class="bold">خالد المطيري</span>. 
  لأدائك كـ<span class="bold">مصممة تجربة مستخدم</span> 
  في <span class="bold">فريق التصميم</span> خلال الربع الأول 2025
</div>

Log output and (if possible) backtrace

N/A

Screenshots or screen recordings

Image

Build flags or config settings

No response

Contribute a patch?

  • I’ll contribute a patch for this myself.

Activity

  1. ahmedrowaihi commented on Jan 3, 2026

    @ahmedrowaihi
    Author

    Hey @Calme1709 @Gingeh ,
    I would love to give it a shot and DIY patch, just curious was there any plan for this ?
    any strategies you are recommending ? specific files that I should focus on?

  2. Gingeh commented on Jan 3, 2026

    @Gingeh
    Contributor

    here's the specification for bidirectional text: https://drafts.csswg.org/css-writing-modes/#bidi-algo
    unfortunately it is quite complex and doesn't actually describe how to implement it :(

  3. added
    bugSomething isn't working
    has reproWe have a way to reproduce this bug.
    on Jan 9, 2026
  4. ahmedrowaihi commented on Jun 12, 2026

    @ahmedrowaihi
    Author

    @AtkinsSJ hey, can u allow me to open a PR ?
    I want to open a PR for this 41b7b07

  5. gmta commented on Jun 12, 2026

    @gmta
    Collaborator

    @ahmedrowaihi

    @AtkinsSJ hey, can u allow me to open a PR ? I want to open a PR for this 41b7b07

    No, we've changed our contribution policy unfortunately.

  6. Psychpsyo commented on Jun 12, 2026

    @Psychpsyo
    Contributor

    here's the specification for bidirectional text: https://drafts.csswg.org/css-writing-modes/#bidi-algo unfortunately it is quite complex and doesn't actually describe how to implement it :(

    How to implement it would be in UAX#9.

  7. ahmedrowaihi commented on Jun 12, 2026

    @ahmedrowaihi
    Author

    @Psychpsyo yes I did implemented that, it's on my own fork and it's working, but the repo ladybird is not allowing PR opening

  8. ahmedrowaihi commented on Jun 12, 2026

    @ahmedrowaihi
    Author

    @gmta this is sad

  9. gmta commented on Jun 12, 2026

    @gmta
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas reproWe have a way to reproduce this bug.layout

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions