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

could toga.Table.focus() have it's no-op override removed? #2972

Open
samtupy opened this issue Nov 19, 2024 · 1 comment
Open

could toga.Table.focus() have it's no-op override removed? #2972

samtupy opened this issue Nov 19, 2024 · 1 comment
Labels
enhancement New features, or improvements to existing features.

Comments

@samtupy
Copy link
Contributor

samtupy commented Nov 19, 2024

What is the problem or limitation you are having?

Currently, the toga.Table.focus() function is a no-op even though it should be implemented on many of the platforms the widget is available on. This means that if I have an app with the primary control being a large table of data, I cannot focus that table programmatically on app startup so users can instantly navigate it with the keyboard. Instead the users must first tab to the table, which is undesirable. An example of such an undesirability is talked about in pr #2956.

Describe the solution you'd like

In core/src/toga/widgets/table.py, the function:

    def focus(self) -> None:
        """No-op; Table cannot accept input focus."""
        pass

exists, and I'm wondering if it's possible that this function could be removed?

Describe alternatives you've considered

Either I must access table._impl.native directly per platform or focus the user on a different default control. I haven't found any other alternatives.

Additional context

This is an app for a visually impaired audience primarily. When such an app starts, it's best for the user to be focused on one of the app's primary controls, so that such a person's screen reader gives extra context about the interface when the app launches. For example instead of the user pressing enter and the screen reader saying something like "app name." It might instead say something like "app name. voices list alt+v." Which sounds a bit nicer as at least some tiny context is provided without exploration, but more importantly the user can then begin instantly navigating the primary control with the keyboard. For now I must just focus the user on a different button or text input instead.

@samtupy samtupy added the enhancement New features, or improvements to existing features. label Nov 19, 2024
@freakboy3742
Copy link
Member

It's been a while since I've looked at this; but my guess is that the "no-op" implementation was added because on at least one platform, the default focus implementation either didn't work, or didn't respond in a way that was detectable. That might be because "focus" on a Table widget could refer to the Table as a whole, or individual rows.

If it's possible to restore focus capability, then we should do so - especially if there's an accessibility implication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

2 participants