mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Fix #27105: Mod search box doesnt track external focus changes
In the Mod selection area, the search bar's focus could be changed by pressing TAB. However, when clicking outside of the search bar, the focus would be killed but two TABs were required to get the focus back on the search bar. This happened because the action of clicking in an empty area would trigger the search bar to change its appearence, but not its internal state. In my solution, I made the OnClick function aware of the search bar's state, so it would not only change its appearance, but also its state. Now, after clicking in an empty area, there is only needed one TAB to select the search box again, as expected.
This commit is contained in:
parent
ca525f6a91
commit
16276dfcd6
@ -420,7 +420,7 @@ namespace osu.Game.Overlays.Mods
|
||||
yield return new ColumnDimContainer(new ModPresetColumn
|
||||
{
|
||||
Margin = new MarginPadding { Right = 10 }
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
|
||||
yield return createModColumnContent(ModType.DifficultyReduction);
|
||||
@ -438,7 +438,7 @@ namespace osu.Game.Overlays.Mods
|
||||
column.Margin = new MarginPadding { Right = 10 };
|
||||
});
|
||||
|
||||
return new ColumnDimContainer(column);
|
||||
return new ColumnDimContainer(column, this);
|
||||
}
|
||||
|
||||
private void createLocalMods()
|
||||
@ -899,13 +899,17 @@ namespace osu.Game.Overlays.Mods
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
public ColumnDimContainer(ModSelectColumn column)
|
||||
private ModSelectOverlay modSelectOverlayInstance;
|
||||
|
||||
public ColumnDimContainer(ModSelectColumn column, ModSelectOverlay modSelectOverlay)
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Child = Column = column;
|
||||
column.Active.BindTo(Active);
|
||||
|
||||
this.modSelectOverlayInstance = modSelectOverlay;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -953,7 +957,7 @@ namespace osu.Game.Overlays.Mods
|
||||
RequestScroll?.Invoke(this);
|
||||
|
||||
// Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action.
|
||||
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null));
|
||||
modSelectOverlayInstance.setTextBoxFocus(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user