Skip to content

Commit 123c578

Browse files
fix(clerk-js): Add inputMode="email" attr to email fields (#6440)
1 parent 3d1d871 commit 123c578

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/blue-ties-follow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Add `inputmode="email"` to email fields to help prompt mobile devices to use a virtual keyboard optimized for entering email addresses.

packages/clerk-js/src/ui/primitives/Input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref)
8181

8282
/**
8383
* type="email" will not allow characters like this one "ö", instead remove type email and provide a pattern that accepts any character before the "@" symbol
84+
* inputMode="email" ensures the email keyboard appears on mobile devices
8485
*/
8586

8687
const typeProps =
8788
type === 'email'
88-
? { type: 'text', pattern: '^.*@[a-zA-Z0-9\\-]+\\.[a-zA-Z0-9\\-\\.]+$' }
89+
? { type: 'text', pattern: '^.*@[a-zA-Z0-9\\-]+\\.[a-zA-Z0-9\\-\\.]+$', inputmode: 'email' }
8990
: { type: type || 'text' };
9091

9192
const passwordManagerProps = ignorePasswordManager

0 commit comments

Comments
 (0)