Open mikeharv opened 2 weeks ago
RLO + PDF sounds good to me--thanks for the explanation of the change. We will accept an upstream PR fixing this, if you file one.
It sounds like you have tested this in RTL, particularly with Arabic. Do you know if this changes anything for the math examples given in #1802?
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: https://github.com/code-dot-org/code-dot-org/pull/62232/commits/f73cc9565cfc423ba6c29dbef1394db83120ec2d
This bug feels similar to one affecting number fields that was reported several years ago: https://github.com/google/blockly/issues/1802
Reproduction steps
true
block to the workspace.Blockly.getSelected().getField('BOOL').menuGenerator_.push(["1 תיבה", "TEXT"])
.Stack trace
No response
Screenshots
Browsers
No response