Skip to content

enhance: Add an option to control browser-level autofill behavior on Windows - #1649

Merged
Legend-Master merged 4 commits into
tauri-apps:devfrom
aoxiangtianyu-go:feat/windows-autofill-control
Feb 23, 2026
Merged

enhance: Add an option to control browser-level autofill behavior on Windows#1649
Legend-Master merged 4 commits into
tauri-apps:devfrom
aoxiangtianyu-go:feat/windows-autofill-control

Conversation

@aoxiangtianyu-go

@aoxiangtianyu-go aoxiangtianyu-go commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

close #1535

This PR adds an optional WebView attribute to control browser-level autofill behavior on Windows.

The motivation for exposing this option is that browser-level autofill behavior in WebView2
is controlled by the underlying runtime and cannot always be influenced through standard
HTML attributes alone. In some scenarios, applications need a way to explicitly opt out of
browser-managed autofill at the WebView level.

The default behavior is preserved unless the option is explicitly set.
The change is limited to the WebView2 implementation and does not affect other platforms.

Related issues

Follow-up

I will submit a separate PR to tauri to expose this API at the application level.

@aoxiangtianyu-go
aoxiangtianyu-go requested a review from a team as a code owner December 31, 2025 15:27

@FabianLars FabianLars left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR! just some nits :)

Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
@aoxiangtianyu-go

Copy link
Copy Markdown
Contributor Author

I’ve addressed the review feedback and pushed the updates. Please let me know if there’s anything I should do.
Thanks!

Comment thread src/webview2/mod.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs
@aoxiangtianyu-go

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I'm currently on Chinese New Year holiday.
I will address the changes after the holiday.

@aoxiangtianyu-go

Copy link
Copy Markdown
Contributor Author

Thanks for the review!
I've updated the docs to reflect the default value and clarified that password and credit card autofill are not affected.

Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
@aoxiangtianyu-go

Copy link
Copy Markdown
Contributor Author

OK Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

Package Changes Through ebfc81f

There are 1 changes which include wry with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
wry 0.54.2 0.54.3

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@Legend-Master
Legend-Master merged commit e430558 into tauri-apps:dev Feb 23, 2026
20 checks passed
Comment thread src/lib.rs
Comment on lines +807 to +809
/// - **Windows**: Supported. On Windows, WebView2's autofill feature (called
/// "Suggestions") may not honor `autocomplete="off"` attributes on input
/// elements in some cases. When this option is `false`, that autofill

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof i had a comment pending here for ages but didn't see that. Do you have some source or references for that issue? I don't think i heard about this before.

@aoxiangtianyu-go aoxiangtianyu-go Feb 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for checking! The behavior I mentioned is documented in the Wry issue #1535, which explains that WebView2’s “Suggestions” (autofill) may ignore autocomplete="off" on input elements in some cases.

In practice, i’ve observed this in clash-verge-rev/clash-verge-rev#5944 , where using autocomplete="new-password" still triggered autofill.

The Wry issue references the official WebView2 setting CoreWebView2Settings.IsGeneralAutofillEnabled as a way to control this behavior globally.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebView2’s “Suggestions” (autofill) may ignore autocomplete="off" on input elements in some cases.

I can't really reproduce that though

where using autocomplete="new-password" still triggered autofill.

That sounds correct no? You asked the browser to trigger autocomplete with new-password

I think maybe we could remove this part from the docs, I don't mind adding this in the wry webview settings though

@aoxiangtianyu-go aoxiangtianyu-go Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really reproduce that though

I was able to successfully reproduce this issue in the clash-verge-rev/clash-ver#5944. However, when I created a brand new Tauri project to build a minimal reproduction case, I failed to reproduce it, and the root cause remains unclear.

That sounds correct no? You asked the browser to trigger autocomplete with new-password

This is not the intended behavior. According to the MDN documentation for the new-password attribute valuenew-password: "This may be used by the browser both to avoid accidentally filling in an existing password and to offer assistance in creating a secure password."
Additionally, MDN security implementation guide explicitly states: "If you are defining a user management page where a user can specify a new password for another person, and therefore, you want to prevent autofilling of password fields, you can use autocomplete="new-password"."
These documents clearly indicate that the intended behavior of new-password is to avoid unwanted autofill of existing passwords, rather than triggering autofill.

I think maybe we could remove this part from the docs, I don't mind adding this in the wry webview settings though

I will fully follow the decision on whether to remove this part from the docs or add it to the wry webview settings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was previously handling an issue with autocomplete=off, where Chrome would ignore it if the input was named password or had the type password. But I'm unsure if this behavior exists in WebView2, as it's also Chromium-based.

These documents clearly indicate that the intended behavior of new-password is to avoid unwanted autofill of existing passwords, rather than triggering autofill.

Though this is not directly related to the issue, just curious.
I'm not quite understanding what you want to achieve with autocomplete="new-password"? I think giving it autocomplete="new-password" attribute is telling the browser to autofill with a new password from a password manager?
If your goal is to turn off the autocomplete, and if it is the logic from WebView2 that it will ignore autocomplete="off" in some specific fields, maybe setting general_autofill_enabled to false is the solution instead of setting autocomplete="new-password"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If your goal is to turn off the autocomplete, and if it is the logic from WebView2 that it will ignore autocomplete="off" in some specific fields, maybe setting general_autofill_enabled to false is the solution instead of setting autocomplete="new-password"?

Exactly. Currently, Tauri and Wry do not expose ICoreWebView2Settings4::SetIsGeneralAutofillEnabled, so using autocomplete="new-password" in the frontend is merely a temporary workaround we're forced to use.

However, as we discussed, these frontend hacks are unreliable because WebView2/Chromium often overrides them. This is precisely why I initiated this PR: to provide a robust, native way to disable autofill at the WebView level during construction, rather than relying on inconsistent HTML attributes.

chriscraws pushed a commit to chriscraws/wry that referenced this pull request May 13, 2026
…dows (tauri-apps#1649)

* feat(windows): add option to control browser autofill behavior

* refactor(webview): use bool for general autofill setting

* docs: update with_general_autofill_enabled docs

* docs: remove uncorrect description
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.

Expose IsGeneralAutofillEnabled WebView2 setting

4 participants