Skip to content

Commit 5ff8358

Browse files
Cancel collection creation with Escape
Use `FocusedTextBox` instead of `OsuTextBox` and kill focus when `GlobalAction.Back` is performed.
1 parent 1168c47 commit 5ff8358

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

osu.Game/Collections/DrawableCollectionListItem.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using osu.Game.Graphics.Containers;
1818
using osu.Game.Graphics.Sprites;
1919
using osu.Game.Graphics.UserInterface;
20+
using osu.Game.Input.Bindings;
2021
using osu.Game.Localisation;
2122
using osu.Game.Overlays;
2223
using osuTK;
@@ -125,7 +126,7 @@ private void onCommit(TextBox sender, bool newText)
125126
}
126127
}
127128

128-
private partial class ItemTextBox : OsuTextBox
129+
private partial class ItemTextBox : FocusedTextBox
129130
{
130131
protected override float LeftRightPadding => item_height / 2;
131132

@@ -182,6 +183,15 @@ private void load(OsuColour colours)
182183
PlaceholderText = CollectionsStrings.CreateNew;
183184
}
184185
}
186+
187+
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
188+
{
189+
// Only respond to GlobalAction.Back
190+
if (!base.OnPressed(e)) return false;
191+
192+
KillFocus();
193+
return true;
194+
}
185195
}
186196

187197
public partial class DeleteButton : OsuClickableContainer

0 commit comments

Comments
 (0)