Ensure `ChatTextBox` takes/leaves focus on chat overlay pop in/out

This commit is contained in:
Jai Sharma 2022-05-03 22:33:36 +01:00
parent c17edb2848
commit 60999e83e0
2 changed files with 12 additions and 2 deletions

View File

@ -26,6 +26,10 @@ public class ChatTextBar : Container
public event Action<string>? OnSearchTermsChanged; public event Action<string>? OnSearchTermsChanged;
public void TextBoxTakeFocus() => chatTextBox.TakeFocus();
public void TextBoxKillFocus() => chatTextBox.KillFocus();
[Resolved] [Resolved]
private Bindable<Channel> currentChannel { get; set; } = null!; private Bindable<Channel> currentChannel { get; set; } = null!;

View File

@ -214,16 +214,22 @@ protected override void OnDragEnd(DragEndEvent e)
protected override void PopIn() protected override void PopIn()
{ {
base.PopIn();
this.MoveToY(0, transition_length, Easing.OutQuint); this.MoveToY(0, transition_length, Easing.OutQuint);
this.FadeIn(transition_length, Easing.OutQuint); this.FadeIn(transition_length, Easing.OutQuint);
base.PopIn();
textBar.TextBoxTakeFocus();
} }
protected override void PopOut() protected override void PopOut()
{ {
base.PopOut();
this.MoveToY(Height, transition_length, Easing.InSine); this.MoveToY(Height, transition_length, Easing.InSine);
this.FadeOut(transition_length, Easing.InSine); this.FadeOut(transition_length, Easing.InSine);
base.PopOut();
textBar.TextBoxKillFocus();
} }
private void currentChannelChanged(ValueChangedEvent<Channel> e) private void currentChannelChanged(ValueChangedEvent<Channel> e)