From ecc51d47016b60e93fcf7736821f2a7230f7778b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 19 Dec 2025 12:17:44 +0100 Subject: [PATCH] Fix disabled form slider bars being half-baked In order of severity: - You could actually click on the textbox portion of a disabled textbox, focus it, select text, input stuff, and commit, which would die on the spot. - The slider part had no visual indication that it's not interactable anymore. --- .../Graphics/UserInterfaceV2/FormSliderBar.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs index 8ebaf48ed6..f4702f000c 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs @@ -207,6 +207,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 } currentNumberInstantaneous.Disabled = disabled; + textBox.ReadOnly = disabled; + updateState(); }; current.CopyTo(currentNumberInstantaneous); @@ -283,7 +285,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 protected override bool OnClick(ClickEvent e) { - focusManager.ChangeFocus(textBox); + if (!Current.Disabled) + focusManager.ChangeFocus(textBox); return true; } @@ -380,7 +383,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 protected override void LoadComplete() { base.LoadComplete(); - updateState(); + Current.BindDisabledChanged(_ => updateState(), true); } protected override void UpdateAfterChildren() @@ -434,8 +437,17 @@ namespace osu.Game.Graphics.UserInterfaceV2 private void updateState() { rightBox.Colour = colourProvider.Background6; - leftBox.Colour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1.Opacity(0.5f) : colourProvider.Dark2; - nub.Colour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1 : colourProvider.Light4; + + if (Current.Disabled) + { + leftBox.Colour = colourProvider.Dark3; + nub.Colour = colourProvider.Dark1; + } + else + { + leftBox.Colour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1.Opacity(0.5f) : colourProvider.Dark2; + nub.Colour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1 : colourProvider.Light4; + } } protected override void UpdateValue(float value)