Skip to content

fix(android): add TYPE_CLASS_TEXT to email/url/password input types#656

Open
hggzm wants to merge 1 commit intomicrosoft:mainfrom
hggzm:clean/fix-email-inputtype-107
Open

fix(android): add TYPE_CLASS_TEXT to email/url/password input types#656
hggzm wants to merge 1 commit intomicrosoft:mainfrom
hggzm:clean/fix-email-inputtype-107

Conversation

@hggzm
Copy link
Copy Markdown
Collaborator

@hggzm hggzm commented Mar 18, 2026

Fork-based PR (no Azure Pipelines CI). When ready for CI, push branch to upstream as users/hggzm/clean/fix-email-inputtype-107 and recreate.

History: upstream PRs #625 (closed)

Summary

When a TextInput has style: "Email", "Url", or "Password", the EditText was configured with only the variation flag (e.g. TYPE_TEXT_VARIATION_EMAIL_ADDRESS) without combining it with TYPE_CLASS_TEXT. Android's InputType requires variation flags to be OR'd with their base class to function correctly.

Without TYPE_CLASS_TEXT, the input type defaults to TYPE_CLASS_NUMBER (0), which:

  • Shows the wrong keyboard layout
  • Prevents TalkBack from announcing the expected input format (e.g. "email address")

Changes

  • TextInputRenderer.java: Combined TYPE_CLASS_TEXT with TYPE_TEXT_VARIATION_EMAIL_ADDRESS, TYPE_TEXT_VARIATION_URI, and TYPE_TEXT_VARIATION_PASSWORD using bitwise OR

Before

editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); // Missing TYPE_CLASS_TEXT

After

editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

Testing

  1. Open a card with a TextInput that has style: "Email"
  2. Enable TalkBack
  3. Focus the email field — TalkBack should announce "email address" format
  4. Verify the correct keyboard layout appears (with @ symbol)
  5. Repeat for URL and Password style inputs

TYPE_TEXT_VARIATION_EMAIL_ADDRESS, TYPE_TEXT_VARIATION_URI, and
TYPE_TEXT_VARIATION_PASSWORD are variation flags that must be combined
with TYPE_CLASS_TEXT to properly configure the keyboard and enable
TalkBack to announce the input type (e.g. 'email address').

Without TYPE_CLASS_TEXT, Android treats the input type as numeric
class (0), resulting in wrong keyboard and no format hint.

Fixes microsoft#107
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.

1 participant