You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for similar issues before opening a new one.
Description
When displaying right-to-left (RTL) text in dropdown fields, Blockly currently uses the Right-to-Left Mark (RLM, U+200F) to suggest RTL directionality. However, this approach leads to inconsistent RTL alignment, as the RLM only hints at RTL layout rather than enforcing it across the entire text.
We found that using the Right-to-Left Override (RLO, U+202E) followed by Pop Directional Formatting (PDF, U+202C) produces a more consistent RTL display by enforcing RTL direction for the entire text. The PDF resets the directional formatting after the text, keeping the override localized to the specific field.
Replacing RLM with RLO+PDF ensures the full text displays in a coherent RTL layout, improving readability and alignment when the container is not styled for RTL. We've made that fix in our field override here: code-dot-org/code-dot-org@f73cc95
This bug feels similar to one affecting number fields that was reported several years ago: #1802
Reproduction steps
From the RTL Blockly Playground, open the Logic toolbox category and drag a true block to the workspace.
Using the console, add an option to the dropdown that includes a mix of RTL characters and Latin characters (e.g.) numbers. For example: Blockly.getSelected().getField('BOOL').menuGenerator_.push(["1 תיבה", "TEXT"]).
Observe the inconsistency between the text in the dropdown menu (an RTL element) and the block field (an LTR element).
Stack trace
No response
Screenshots
Browsers
No response
The text was updated successfully, but these errors were encountered:
Check for duplicates
Description
When displaying right-to-left (RTL) text in dropdown fields, Blockly currently uses the Right-to-Left Mark (RLM, U+200F) to suggest RTL directionality. However, this approach leads to inconsistent RTL alignment, as the RLM only hints at RTL layout rather than enforcing it across the entire text.
We found that using the Right-to-Left Override (RLO, U+202E) followed by Pop Directional Formatting (PDF, U+202C) produces a more consistent RTL display by enforcing RTL direction for the entire text. The PDF resets the directional formatting after the text, keeping the override localized to the specific field.
Replacing RLM with RLO+PDF ensures the full text displays in a coherent RTL layout, improving readability and alignment when the container is not styled for RTL. We've made that fix in our field override here: code-dot-org/code-dot-org@f73cc95
This bug feels similar to one affecting number fields that was reported several years ago: #1802
Reproduction steps
true
block to the workspace.Blockly.getSelected().getField('BOOL').menuGenerator_.push(["1 תיבה", "TEXT"])
.Stack trace
No response
Screenshots
Browsers
No response
The text was updated successfully, but these errors were encountered: