Skip to content

lang, spellcheck and dir on text inputs seem to have been lost after migration #4506#4507

Draft
edloidas wants to merge 2 commits into
masterfrom
claude/tender-mccarthy-fCb2B
Draft

lang, spellcheck and dir on text inputs seem to have been lost after migration #4506#4507
edloidas wants to merge 2 commits into
masterfrom
claude/tender-mccarthy-fCb2B

Conversation

@edloidas
Copy link
Copy Markdown
Member

Added a new LocaleContext (LocaleProvider + useLocale) in form2/ so consumer apps can pass the active content language to the React input layer. TextLineInput and TextAreaInput now read the locale and apply lang, dir="rtl" for RTL languages, and spellcheck="true" on the rendered <input> / <textarea> — restoring parity with the legacy TextInputType auto-wiring.

Reused Locale.extractLanguage and Locale.supportsRtl for the RTL detection. Added a shared getLangAttributes helper in form2/utils/ with unit tests. Added Storybook stories demonstrating Norwegian (lang) and Arabic (RTL).

…migration #4506

Added a new `LocaleContext` (`LocaleProvider` + `useLocale`) in form2/ so
consumer apps can pass the active content language to the React input layer.
TextLineInput and TextAreaInput now read the locale and apply `lang`,
`dir="rtl"` for RTL languages, and `spellcheck="true"` on the rendered
`<input>` / `<textarea>` — restoring parity with the legacy `TextInputType`
auto-wiring.

Reused `Locale.extractLanguage` and `Locale.supportsRtl` for the RTL detection.
Added a shared `getLangAttributes` helper in `form2/utils/` with unit tests.
Added Storybook stories demonstrating Norwegian (`lang`) and Arabic (RTL).
@edloidas edloidas self-assigned this May 26, 2026
Inlined the RTL code set and Arabic-script subtag check directly into
getLangAttributes so form2 no longer depends on the legacy Locale class
for this path. Locale input is now case-insensitive (e.g. NB-NO -> nb).

Added test coverage for:
- Arabic-script subtag (ks-Arab -> dir=rtl)
- Mixed-case locale normalization
- TextLineInput VNode actually carrying lang/dir/spellCheck through the
  LocaleContext (no provider, non-RTL, RTL).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants