fix: RTL support broken on chatgpt.com — responses in RTL languages render LTR - #36
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix RTL support for responses in RTL languages
fix: RTL support broken on chatgpt.com — responses in RTL languages render LTR
Jun 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes RTL rendering on chatgpt.com by adding a ChatGPT-specific CSS selector set and selecting it in the content script when the hostname matches chatgpt.com, since ChatGPT responses typically lack lang/dir attributes that the generic RTL selector relies on.
Changes:
- Add
CHATGPT_RTL_CSSto target ChatGPT assistant message markdown blocks and applyunicode-bidi: plaintext+text-align: start. - Add
CHATGPT_HOSTNAMESand update the content script to choose RTL CSS in three tiers (YouTube / ChatGPT / generic). - Update the bundled
content.jsoutput and document the fix inCHANGELOG.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib/css.js | Introduces CHATGPT_RTL_CSS targeting ChatGPT assistant markdown output. |
| src/lib/config.js | Adds CHATGPT_HOSTNAMES for site-specific RTL handling. |
| src/content.js | Selects the appropriate RTL CSS (YouTube vs ChatGPT vs generic) during render. |
| content.js | Updates the built/bundled content script to include the new CSS/hostname logic. |
| CHANGELOG.md | Adds an Unreleased changelog entry documenting the ChatGPT RTL fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kalagar
marked this pull request as ready for review
June 20, 2026 18:57
kalagar
approved these changes
Jun 20, 2026
kalagar
approved these changes
Jun 20, 2026
kalagar
added a commit
that referenced
this pull request
Jun 20, 2026
🤖 I have created a release *beep* *boop* --- ## [1.4.1](v1.4.0...v1.4.1) (2026-06-20) ### Bug Fixes * RTL support broken on chatgpt.com — responses in RTL languages render LTR ([#36](#36)) ([65f938f](65f938f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ChatGPT doesn't annotate its response containers with
langordirattributes, soGENERAL_RTL_CSS([lang|="ar"],[dir="rtl"], etc.) never matched any element — enabling RTL for chatgpt.com had no effect.Changes
src/lib/css.js— addsCHATGPT_RTL_CSStargeting ChatGPT's actual response DOM:[data-message-author-role="assistant"] .markdownand its block-level descendants (p,li,h1–h6,blockquote,pre,td,th) withunicode-bidi: plaintext; text-align: start. Same bidi-algorithm approach used for YouTube — no JS text scanning needed.src/lib/config.js— addsCHATGPT_HOSTNAMESset (chatgpt.com,www.chatgpt.com) to identify when the site-specific CSS path applies.src/content.js—render()now selects CSS in three tiers: YouTube →RTL_CSS, ChatGPT →CHATGPT_RTL_CSS, everything else →GENERAL_RTL_CSS.The RTL toggle for chatgpt.com already exists in the popup and Options page — users just need to enable it.
Test plan