macOS system autocomplete cannot be disabled on via standard HTML attributes

Description

On macOS, system-level autocomplete suggestions appear in <textarea> elements even when all relevant HTML attributes intended to disable autocomplete and text assistance are explicitly set.

Is this behavior intentional, or is there any supported way for developers to control or disable this functionality?

Steps to Reproduce

  • Send yourself an email using the native macOS Mail app containing a verification code (for example).
  • Focus an HTML <textarea> element in any web application.
  • Focus the textarea.

Expected Result

The autocomplete popup should be controllable from the code, and it should be possible to fully disable it using standard HTML attributes or browser APIs.

Actual Result

The system autocomplete popup appears in all cases and cannot be controlled or disabled by the code, even when all known attributes (autocomplete="off", autocorrect="off", autocapitalize="off", spellcheck="false") are set.

On macOS, the behavior of system-level autocomplete suggestions in <textarea> elements can indeed be frustrating for developers who wish to have full control over this feature. This behavior is primarily controlled by the operating system and the browser, rather than being fully customizable through standard HTML attributes or JavaScript APIs. Here are some insights and potential workarounds:

Intentional Behavior

User Experience: Apple designs macOS to enhance user convenience by offering autocomplete suggestions for common inputs, such as email addresses, phone numbers, and verification codes. This is intended to streamline user interactions and reduce typing effort. Security and Privacy: By controlling autocomplete at the system level, Apple aims to protect user privacy and security, ensuring that sensitive information is not automatically filled in without explicit user consent.

Limitations of HTML Attributes

Standard Attributes: Attributes like autocomplete="off", autocorrect="off", autocapitalize="off", and spellcheck="false" are intended to guide browser behavior regarding form field autocomplete. However, on macOS, these attributes may not fully override the system-level autocomplete suggestions, especially for specific types of content like email verification codes.

Potential Workarounds

While you cannot completely disable system-level autocomplete on macOS, you can try the following approaches to mitigate its impact or improve user experience:

Custom Input Fields: Instead of using <textarea>, create a custom input field using <div> and <input type="text"> elements. You can then style it to resemble a <textarea> and implement your own logic for handling line breaks and input expansion. JavaScript Interception: Listen for input events on the <textarea> and manually manipulate the content to remove or format autocomplete suggestions as they appear. This is a workaround and may not be foolproof, especially with rapid input or complex suggestions. Instructional Text: Provide clear instructions to users near the <textarea>, explaining that autocomplete suggestions may appear and how they can manage or ignore them. App-Specific Settings: If your application is used in a controlled environment (e.g., within an enterprise), consider communicating with Apple or exploring enterprise policies that might allow for more granular control over autocomplete settings.

Ultimately, while you have limited control over system-level autocomplete on macOS, these strategies can help you manage its impact and enhance the user experience within your web application.

macOS system autocomplete cannot be disabled on via standard HTML attributes
 
 
Q