osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

Allow slider bar to take focus and accept keyboard input while not hovered

Open OliBomby opened this issue 1 year ago • 5 comments

This change would allow you to click the slider bar, have it gain focus, and then adjust the slider bar with the keyboard while the cursor is not hovering the slider bar.

This matches the user expectation because you can do the same thing in osu! stable. In current lazer the only way to do this is click away to unfocus everything, then hover the slider bar while using keyboard. This flow is apparently so confusing that someone in Discord thought it wasn't possible at all.

Discord_XhhdbulGlk

https://github.com/user-attachments/assets/19d901c3-4130-48f8-be75-bedc75a6676f

Discord_5hnRVUNu9n

OliBomby avatar Oct 16 '24 19:10 OliBomby

Also test failures

bdach avatar Oct 17 '24 05:10 bdach

That said, it should have focus feedback. Not many UIs do this, but I feel like it's needed for lazer. In Windows 11, the volume control shows an outline with the number always visible when using keyboard:

Correct me if I'm wrong, but I think the visual feedback is to be fixed on lazer's side, not framework. I can follow up with a PR on lazer for focus feedback after this is merged.

OliBomby avatar Oct 17 '24 21:10 OliBomby

Yes, but the visual can be basic, to demonstrate the behavior and implementation here (in BasicSliderBar). It's mostly for framework consumers, and it'll not be as subjective as lazer's side.

Joehuu avatar Oct 17 '24 22:10 Joehuu

You're so right. How didnt i notice this

OliBomby avatar Oct 19 '24 07:10 OliBomby

The Basic display's active state is quite shoddy. Haven't dived into the code yet.

peppy avatar Oct 21 '24 06:10 peppy

There's no osu! side PR to see how this will look yet is there?

peppy avatar Oct 21 '24 10:10 peppy

https://github.com/ppy/osu/pull/30315 was vaguely linked but does not actually use anything from this PR or include any visual changes to sliders to indicate focus.

bdach avatar Oct 21 '24 10:10 bdach

I think I'd want to see that, just to confirm everything is as it should be, before going ahead with this.

Also arguably, this is changing the UX of this control and other framework consumers may prefer the old behaviour. I'm relatively neutral on it, but maybe we want focus to be given when hovering and arrow keys are used to keep the old behaviour also working?

peppy avatar Oct 21 '24 10:10 peppy

maybe we want focus to be given when hovering and arrow keys are used to keep the old behaviour also working?

This suggestion confuses me. The way I have it implemented now does allow you to use the old behaviour, that is adjusting the slider bar with keyboard while hovering without focusing. To allow keyboard input it needs either focus or hover state. To give (persisting) focus when hovering is not necessary and its not how it works in OSes, which I aim to mimic.

OliBomby avatar Oct 21 '24 16:10 OliBomby

Right, it has been fixed in the latest commits.

peppy avatar Oct 22 '24 09:10 peppy

I'm tentatively okay with this, but would still want to see the osu!-side change before merging.

peppy avatar Oct 22 '24 09:10 peppy