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

fix: ios PasswordBox changed event when focus #19337

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ajpinedam
Copy link
Contributor

GitHub Issue (If applicable): closes #

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

PasswordBox, when unfocused and focused, sends a TextChanged event.

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@ajpinedam ajpinedam self-assigned this Jan 27, 2025
@github-actions github-actions bot added the platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform label Jan 27, 2025
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19337/index.html

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19337/index.html

@@ -19,10 +20,10 @@ namespace Microsoft.UI.Xaml.Controls
{
public partial class SinglelineTextBoxView : UITextField, ITextBoxView, DependencyObject, IFontScalable
{
private SinglelineTextBoxDelegate _delegate;
private SinglelineTextBoxDelegate _delegate = null!;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private SinglelineTextBoxDelegate _delegate = null!;
private SinglelineTextBoxDelegate _delegate;

and tag Initialize() with [MemberNotNull(nameof(_delegate))]

Comment on lines +115 to 125
if (SecureTextEntry && !string.IsNullOrEmpty(Text))
{
UnsubscribeEditingEvents();

var text = Text;
Text = string.Empty;
UpdatePasswordText(string.Empty);
InsertText(text);
UpdatePasswordText(text);

SubscribeEditingEvents();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldnt it be better to use a flag to guard the handlers, instead of un- and re-registering the events?

@@ -54,7 +55,7 @@ private void HandlePaste(Action baseAction)

internal TextBox TextBox => _textBox.GetTarget();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
internal TextBox TextBox => _textBox.GetTarget();
internal TextBox? TextBox => _textBox.GetTarget();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants