RTL: right-align number next to the flag/dial-code button (pure-CSS layout)#1
Open
johnnyshields wants to merge 1 commit into
Open
RTL: right-align number next to the flag/dial-code button (pure-CSS layout)#1johnnyshields wants to merge 1 commit into
johnnyshields wants to merge 1 commit into
Conversation
johnnyshields
force-pushed
the
rtl-dial-code-prefix
branch
from
July 6, 2026 05:15
89ec0f6 to
1f9a779
Compare
johnnyshields
force-pushed
the
rtl-dial-code-prefix
branch
from
July 6, 2026 10:46
1f9a779 to
9016480
Compare
…ayout) Opinionated TableCheck RTL layout: the phone number is right-aligned so it sits beside the country button, and the number, separate dial code and flag read as one group hugging the flag — e.g. "51 234 5678 +966 🇸🇦". - No direction detection in JS, and the dial code keeps ONE position (inside the country button, upstream default) that serves both LTR and RTL. - Layout is pure CSS, scoped to :dir(rtl): right-align the number and move the flag-clearance padding to the input's physical inline-end. - Why the one JS touch: browsers resolve a tel input's own direction as LTR even inside an RTL page, so ui.ts's flag-clearance padding-inline-start lands on the physical LEFT — the wrong side when the button is on the right. ui.ts now also publishes that already-measured width as the --iti-country-clearance custom property (a measurement only); the :dir(rtl) rule neutralises the left padding and re-applies the clearance on the right. The direction/side decision is 100% in CSS. Only the RTL visual snapshot changes; the other 8 are byte-identical and the LTR path is untouched. typecheck clean, e2e 17 passed, node unit suite 508 passed.
johnnyshields
force-pushed
the
rtl-dial-code-prefix
branch
from
July 6, 2026 13:12
9016480 to
a2d347d
Compare
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.
Summary
Builds on the logical-properties RTL work (
rtl-logical-properties, PR jackocnr#2181) with an opinionated RTL layout for TableCheck: the phone number is right-aligned so it sits next to the country button, and the number, the separate dial code and the flag read as one group hugging the flag — e.g.51 234 5678 +966 🇸🇦— inside a full-width field.No direction detection in JS · one dial-code position · pure-CSS layout
ui.ts— nogetComputedStyle/direction checks. The separate dial code keeps one position (inside the country button, the upstream default) that serves both LTR and RTL.:dir(rtl): right-align the number and put the flag-clearance on the input's physical inline-end.telinput's own direction as LTR even inside an RTL page, so ui.ts's existing flag-clearancepadding-inline-startlands on the physical LEFT — the wrong side when the country button is on the right. ui.ts now also publishes that already-measured button width as the--iti-country-clearancecustom property; the:dir(rtl)rule neutralises the left padding and re-applies the clearance on the right. The direction/side decision is 100% in CSS — JS only reports a width (exactly as upstream already does forpadding-inline-start).The
:dir(rtl)scope is keyed off the wrapper's directionality (a plain<div>, whose:dirresolves reliably), so it doesn't depend on the<input>'s own (LTR):dir.Scoped to RTL — LTR is byte-for-byte unchanged
All CSS is under
:dir(rtl); the JS change only sets a custom property (LTR keeps using the same inlinepadding-inline-startit always did). Concretely: only the RTL visual snapshot changes — the other 8 snapshots are pixel-identical, and the field keeps the consumer's width with the dropdown aligned under it.Testing
51 234 5678 +966 🇸🇦in a full-width field, no overlap, a space before the dial code, dropdown aligned) and that the 8 non-RTL snapshots are unchanged.Base
Targets
rtl-logical-propertiesso the diff is just this RTL layout on top of the logical-properties conversion.