Explain Codes LogoExplain Codes Logo

How do you turn off auto-capitalisation in HTML form fields in iOS?

html
responsive-design
platform-specific-behaviours
keyboard-behaviours
Anton ShumikhinbyAnton Shumikhin·Aug 25, 2024
TLDR

To disable auto-capitalization in HTML input fields on iOS, use autocapitalize="none". This ensures the iOS keyboard won't capitalize the first letter automatically.

<input type="text" autocapitalize="none" />

For legacy iOS versions, or specific non-email fields, use a combo of autocorrect and autocapitalize:

<input type="text" autocorrect="off" autocapitalize="none" />

For email fields, type="email" implicitly disables auto-capitalisation on iOS 5+:

<input type="email" />

Working with React Native? Use these props to control these behaviours:

<TextInput autoCapitalize="none" autoCorrect={false} />

Nitty-gritty of disabling autocapitalisation

Handling legacy iOS versions

Remember, older iOS versions might have different behaviours. Thus, testing your implementation across various versions is a wise strategy for consistency assurance.

Dealing with React Native

In React Native, remember to use camelCase for properties such as autoCapitalize and autoCorrect. Moreover, note the difference in handling input properties, particularly due to platform-specific behaviours.

Augmenting the user experience

Take control: turning off autocorrect

Consider turning off autocorrect along with auto-capitalisation. This is particularly helpful when dealing with unique terms or code where you want to prevent any unintended replacements.

<input type="text" autocorrect="off" />

Service your forms: catering to complexities

When dealing with complex forms, manage the keyboard behaviours of different fields by utilising the respective attributes. This is crucial in optimising the user experience, especially when dealing with multilingual input or technical data.

Craft Compatibility: understanding platform-specific controls

It's essential to understand and accommodate platform-specific controls and their implications on these attributes. For the best results, validate your forms on actual iOS devices to ensure compatibility.