Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility: Follow Keyboard Focus #97

Closed
baconpaul opened this issue Mar 9, 2024 · 6 comments · Fixed by #102
Closed

Accessibility: Follow Keyboard Focus #97

baconpaul opened this issue Mar 9, 2024 · 6 comments · Fixed by #102

Comments

@baconpaul
Copy link
Collaborator

This relates to #19

Perhaps the most important thing for screen reader users i found was the ability for keyboard focus to do the expected thing. Getting that order correct matters a lot. If you run surge and shift click on the menu you will see "developer options" and theres a focus debugger in there which red highlights and lets you tab/shift-tab with the UI available, and if you have a console attached it shows you the accessible name

So it would be great if instead of 'mouse over' component melatonin could optionally follow 'focused component'

I do this now by having a FocusChangeListener registered which does this: https://github.com/surge-synthesizer/surge/blob/0ca1e207de22407e4c12eb9f228f71c617cb6689/src/surge-xt/gui/SurgeGUIEditor.cpp#L6370

but presumably it would be possible to have melatonin selection optionally driven by a focus change listener as opposed to mouse position tracking. So opening this issue just to document that idea. I may hack it in next fortnight or so as i peek at the code.

@sudara
Copy link
Owner

sudara commented Mar 9, 2024

This would be great — just to confirm, it would basically be a "mode" like "keyboard focus debug mode" that you would toggle on and the inspector would then only navigate by keyboard vs. mouse?

@sudara
Copy link
Owner

sudara commented Mar 9, 2024

If you get a PR going, I'll cook up an icon for the header to toggle (this is a figma screenshot, the move toggle and "dog food" aren't yet implemented, unfortunately!).

Figma - 2024-03-09 02@2x

@sudara
Copy link
Owner

sudara commented Mar 9, 2024

BTW, I added you as a collaborator, feel free to push branches to the main repo vs. a fork. I believe merging takes approval from me (or one of the other collaborators?)

@baconpaul
Copy link
Collaborator Author

This would be great — just to confirm, it would basically be a "mode" like "keyboard focus debug mode" that you would toggle on and the inspector would then only navigate by keyboard vs. mouse?

Exactly

baconpaul added a commit to baconpaul/melatonin_inspector that referenced this issue Mar 13, 2024
1. Add a setSelectionMode with an enum for current FOLLOWS_MOUSE
   or FOLLOWS_FOCUS
2. Unregister / register appropriate focus listener, structure for
   other options
3. Add the listener to update state

With this plus `inspectr->setFocusMode` called explicitly on launch
melatonin is equivalent to the surge focus debugger. Awesome.

The primary thing not done yet is a toggle button in teh UI to swap
modes. You can only swap programatically.

Addresses sudara#97
@sudara
Copy link
Owner

sudara commented Mar 15, 2024

#101 was merged, but I noticed when selectionMode changes, it doesn't disable mouse listening. In other words, it's just toggling FOLLOW_FOCUS on or off.

I'm wondering if the mouse listening should be disabled when FOLLOW_FOCUS is set?

I tried it out: It can feel "cleaner" with mouse listening disabled, being forced to navigate with keyboard focus. But maybe it will require a bit of refactoring to "keep the overlay visible but disable mouse events."

If not, then does keyboard focus even need to be toggled in the first place? Maybe it should just always be on? Or at least default ON with the ability to turn OFF?

@baconpaul
Copy link
Collaborator Author

Absolutely yes. I struggled a bit with figuring out what internal state to develop also.

Ideally it would work with mouse mode for most devs. I think that's what they want except when accessibility debugging. I'll add a menu to surge to turn on focus debugging which launches melatonin if not there and then makes it launch in focus mode as well as a menu to just launch regular mouse melatonin.

Thank you for merging the starting point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants