Skip to content

[dev-v5][TextInput] Added parameter to hide Show Password toggle in Microsoft Edge#5039

Open
TimTheBimLim wants to merge 3 commits into
microsoft:dev-v5from
TimTheBimLim:hide-edge-password-toggle
Open

[dev-v5][TextInput] Added parameter to hide Show Password toggle in Microsoft Edge#5039
TimTheBimLim wants to merge 3 commits into
microsoft:dev-v5from
TimTheBimLim:hide-edge-password-toggle

Conversation

@TimTheBimLim

Copy link
Copy Markdown

Pull Request

📖 Description

This is a new feature that allows developers to disable the password reveal button in Microsoft Edge via a new HideEdgePasswordToggle boolean parameter, using the ::ms-reveal CSS control under-the-hood. Because the component is rendered in the Shadow DOM, setting the style in CSS does not work. Currently, developers using this library would have to write custom JavaScript to get this functionality to work without this change.

🎫 Issues

I could not find any related issues, however there was a prior discussion related to this feature.

👩‍💻 Reviewer Notes

This PR adds a HideEdgePasswordToggle parameter to FluentTextField that hides the Microsoft Edge native password reveal button on password fields. The button is injected into the shadow DOM via a :-ms-reveal pseudo-element, so it requires a small style injection into the shadow root via JS. I am not opposed to changing the name of this parameter. I did feel that "HideEdgePasswordReveal" would be a bit confusing with "Hide" and "Reveal" in the same parameter name.

I am relatively new to open source contributions and willing to change whatever is needed.

Smoke test:

  • Add a to a page
  • Open in Microsoft Edge
  • Type into the field - the native reveal button should not appear
  • Ensure FluentTextField still works in other browsers

📑 Test Plan

Unit tests in FluentTextInputTests.razor cover the new parameter. Manual testing performed in Edge to verify the password reveal button is hidden when HideEdgePasswordToggle="true" and visible when false.

✅ Checklist

General

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new component
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

⏭ Next Steps

This would be a bigger change, but potentially better ways to interact with these types of controls in the Shadow DOM in general. Though that change would only be tangentially related to this PR.

Copilot AI review requested due to automatic review settings July 22, 2026 02:07
@TimTheBimLim

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@TimTheBimLim TimTheBimLim changed the title [dev-v5][TextInput] Added parameter to hide Show Password toggle in Microsoft… [dev-v5][TextInput] Added parameter to hide Show Password toggle in Microsoft Edge Jul 22, 2026

Copilot AI 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.

Pull request overview

This PR introduces an opt-in feature on FluentTextInput to hide Microsoft Edge’s native password reveal UI by injecting a ::-ms-reveal style into the component’s shadow root via JavaScript interop, addressing the limitation that consumer CSS cannot reach into the shadow DOM.

Changes:

  • Added a new HideEdgePasswordToggle [Parameter] to FluentTextInput and a corresponding JS interop call in OnAfterRenderAsync.
  • Added a TypeScript helper (setEdgePasswordRevealToggle) that injects/removes a <style> tag inside the shadow root.
  • Added bUnit tests covering the new parameter’s impact on rendered markup.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/Core/Components/TextInput/FluentTextInputTests.razor Adds tests for the new parameter (currently focused on markup behavior).
src/Core/Components/TextInput/FluentTextInput.razor.cs Introduces the HideEdgePasswordToggle parameter and triggers JS interop for password inputs.
src/Core.Scripts/src/Components/TextInput/TextInput.ts Implements the shadow-root style injection/removal for Edge’s ::-ms-reveal.

Comment thread src/Core/Components/TextInput/FluentTextInput.razor.cs Outdated
Comment thread tests/Core/Components/TextInput/FluentTextInputTests.razor
Comment thread src/Core.Scripts/src/Components/TextInput/TextInput.ts Outdated
@TimTheBimLim
TimTheBimLim force-pushed the hide-edge-password-toggle branch from a35b056 to 3ea0e61 Compare July 22, 2026 02:42
/// Gets or sets a value indicating whether the Microsoft Edge password toggle should be hidden for password fields.
/// </summary>
[Parameter]
public bool HideEdgePasswordToggle { get; set; }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this parameter is too specific to a particular browser. I need to look into this further to find a more general solution. Give me until next week—that way I'll have more time.

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.

3 participants