Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: 浏览器自动填充密码时,建议隐藏password #1433

Closed
limei7 opened this issue Jul 18, 2023 · 2 comments
Closed

[Bug Report]: 浏览器自动填充密码时,建议隐藏password #1433

limei7 opened this issue Jul 18, 2023 · 2 comments
Assignees
Labels
component/TextField platform specific The issue only occurs on a specific platform
Milestone

Comments

@limei7
Copy link

limei7 commented Jul 18, 2023

Masa.Blazor version

1.0.0

Describe the bug

image

https://auth-test.masastack.com/User

Expected Behavior

No response

Steps To Reproduce

No response

Reproduction code

No response

.NET version

No response

What browsers are you seeing the problem on?

No response

Additional context

No response

@limei7 limei7 added this to the 1.0.0 milestone Jul 18, 2023
@capdiem capdiem removed this from the 1.0.0 milestone Jul 18, 2023
@capdiem
Copy link
Contributor

capdiem commented Jul 26, 2023

@MayueCif 调查了一下,edge需要点击才会将密码和账号填充到输入框,此时会触发input事件。但chrome浏览器会自动添加,不会触发input事件或其他事件,似乎无法让值更新到Blazor的状态。目前有个解决办法是,password输入框type默认为text,此时不会触发自动填充的行为,但用户点击输入框再设置为password。

@capdiem capdiem added platform specific The issue only occurs on a specific platform and removed status/investigate labels Jul 26, 2023
@capdiem capdiem added this to the 1.8.0 milestone Jun 5, 2024
@capdiem
Copy link
Contributor

capdiem commented Oct 23, 2024

  • Avoid overlapping the label with the input:

    <MTextField @bind-Value="name" Label="Name" @ref="_textField"></MTextField>
    
    @code {
        private MTextField<string>? _textField;
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                await JS.InvokeVoidAsync(JsInteropConstants.AddCls, _textField?.LabelReference?.Ref, "m-label--active");
            }
        }
    }
  • Set the background color for autofill:

    input:-webkit-autofill {
      box-shadow: 0 0 0 1000px white inset !important;
      -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    }

@capdiem capdiem closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/TextField platform specific The issue only occurs on a specific platform
Projects
None yet
Development

No branches or pull requests

2 participants