Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Make Grid Rows Focusable?
I have a grid on a page where the whole row is selectable with a mouse click.
I want the grid rows to be focusable so that I can tab to the rows and select the row with the enter key.
Is there a way to set each grid row as focusable?
Set the selection mode to single: <vaadin-grid selection-mode="single">
Although you'll need to use arrow keys to move the selection and enter to select, like in other select components. Tab will only move between focusable elements.
Marcus Hellberg: Set the selection mode to single: <vaadin-grid selection-mode="single">
It's not written declaratively with elements. Is there a Java method that does this?
This is the Vaadin Elements forum, so I assumed that you were referring to the Elements grid.
If you are working with the framework Grid, the method you're looking for is https://vaadin.com/api/7.6.8/com/vaadin/ui/Grid.html#setSelectionMode(com.vaadin.ui.Grid.SelectionMode)
My apologies. I do see that we already have setSelectionMode(SelectionMode.SINGLE);
I'll try to move this to the other forum.