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

Make Tab + Shift Tab move focus on Web #4714

Open
iruizmar opened this issue Apr 27, 2024 · 0 comments
Open

Make Tab + Shift Tab move focus on Web #4714

iruizmar opened this issue Apr 27, 2024 · 0 comments
Labels
enhancement New feature or request web

Comments

@iruizmar
Copy link

iruizmar commented Apr 27, 2024

I found this document stating that Tab and Shift+Tab are supposed to automatically move the focus to the next/previous focusable element but I supposed this is only for Compose Desktop because it's not working on a JS app.

It's easy to add by re-adding manually the moveFocusOnTab modifier that used to be on that document:

fun Modifier.moveFocusOnTab() = composed {
    val focusManager = LocalFocusManager.current
    onPreviewKeyEvent {
        if (it.type == KeyEventType.KeyDown && it.key == Key.Tab) {
            focusManager.moveFocus(
                if (it.isShiftPressed) FocusDirection.Previous else FocusDirection.Next
            )
            true
        } else {
            false
        }
    }
}

But it'd be cool if this was happening automatically.

Thanks!

@iruizmar iruizmar added enhancement New feature or request submitted labels Apr 27, 2024
@Schahen Schahen added web and removed submitted labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web
Projects
None yet
Development

No branches or pull requests

2 participants