lang, spellcheck and dir on text inputs seem to have been lost after migration #4506#4507
Draft
edloidas wants to merge 2 commits into
Draft
lang, spellcheck and dir on text inputs seem to have been lost after migration #4506#4507edloidas wants to merge 2 commits into
edloidas wants to merge 2 commits into
Conversation
…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).
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).
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.
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 applylang,dir="rtl"for RTL languages, andspellcheck="true"on the rendered<input>/<textarea>— restoring parity with the legacyTextInputTypeauto-wiring.Reused
Locale.extractLanguageandLocale.supportsRtlfor the RTL detection. Added a sharedgetLangAttributeshelper inform2/utils/with unit tests. Added Storybook stories demonstrating Norwegian (lang) and Arabic (RTL).