Repository navigation
Fix Studio toast close-button positioning - #7142
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the automatic setting of the document's text direction (dir attribute) during locale synchronization and cleans up the unused dir metadata from the locales configuration. It also introduces a regression test suite to enforce this behavior. The review feedback recommends specifying encoding="utf-8" when reading files in the Python tests to avoid platform-dependent encoding issues, particularly since the localization files contain non-ASCII characters.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
|
||
|
|
||
| def test_locale_changes_do_not_force_document_direction(): | ||
| src = LOCALE_STORE.read_text() |
There was a problem hiding this comment.
When reading files in Python, always specify encoding="utf-8" to prevent platform-dependent encoding failures (e.g., on Windows) where default codecs might fail on non-ASCII characters.
| src = LOCALE_STORE.read_text() | |
| src = LOCALE_STORE.read_text(encoding="utf-8") |
References
- When opening and reading configuration files (such as
tokenizer_config.jsoncontaining chat templates) in Python, always specifyencoding='utf-8'to prevent platform-dependent encoding failures (e.g., on Windows) where default codecs might fail on non-ASCII characters.
|
|
||
|
|
||
| def test_locale_metadata_does_not_advertise_unused_layout_direction(): | ||
| src = MESSAGES.read_text() |
There was a problem hiding this comment.
When reading files in Python, always specify encoding="utf-8" to prevent platform-dependent encoding failures (e.g., on Windows) where default codecs might fail on non-ASCII characters. This is especially important here because messages.ts contains non-ASCII characters like Chinese, Japanese, Korean, Hindi, and Arabic.
| src = MESSAGES.read_text() | |
| src = MESSAGES.read_text(encoding="utf-8") |
References
- When opening and reading configuration files (such as
tokenizer_config.jsoncontaining chat templates) in Python, always specifyencoding='utf-8'to prevent platform-dependent encoding failures (e.g., on Windows) where default codecs might fail on non-ASCII characters.
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Root cause
PR #7076 added document direction synchronization for an RTL Arabic layout. Arabic was later kept on an LTR layout because Studio still uses physical-direction CSS, but the root
dir="ltr"assignment remained for every locale.Sonner defines close-button variables under
html[dir="ltr"], including a start position of zero. The Studio override usedunset, which inherits for custom properties, so Sonner's root value won and placed the close button over the status icon.This change removes the unused global direction mutation and uses
autofor the close button's start position. The close button therefore remains pinned eight pixels from the right edge even ifdir="ltr"ordir="rtl"is set later.Before and after
Before this PR:
After this PR:
langwithout mutating global layout direction.Scope and compatibility
This PR changes no backend, model, hardware, operating-system, packaging, or inference path. Existing supported paths are untouched. The language selector, automatic detection, persisted preferences, personalization synchronization, locale overlays, and per-element bidirectional text behavior remain intact. The dropdown cap is local to the language selector and does not affect shared dropdown components.
Testing
npm run i18n:checknpm run typechecknpm run buildpytest -q tests/studio/test_locale_root_direction_contract.pyon Python 3.10, 3.11, 3.12, and 3.13, with 3 passing tests on each versionNative Safari automation requires the local Safari remote-automation permission, and native Windows validation remains covered by the repository's Windows CI runners.