Skip to content

Table Keyboard Navigation with Header Row Hides First Data Row #5088

Description

@groboclown

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

I created a Table widget and included a header row. I filled the row with enough data to allow the table to have a scroll bar.

When I use the keyboard to navigate up and down, before scrolling, the "current focus" cell moves correctly up to row 0. However, if you scroll with the keyboard such that the table scrolls down, then scroll back to the top, the "current focus" row will move what seems like under the header and will no longer be visible. It means the top row (row 0) will never be viewable in this table view without using the mouse.

How to reproduce

  1. Create a table with a header, and fill the cells with simple data.
  2. Click on a cell to allow keyboard navigation.
  3. Press the "up" key. The active cell correctly remains visible even when the up key is pressed with row zero active.
  4. Scroll down with the "down" key such that the displayed cells scroll.
  5. Press the "up" key to return to the top. The displayed active cell will disappear, and the top row does not show up, as though it's hidden under the table header.

Screenshots

TableKeyboardScroll

Example code

package main

import (
	"strconv"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Table Scroll")

	t := widget.NewTable(
		func() (rows int, cols int) { return 1000, 1 },
		func() fyne.CanvasObject { return widget.NewLabel("000") },
		func(tci widget.TableCellID, co fyne.CanvasObject) {
			co.(*widget.Label).SetText(strconv.FormatInt(int64(tci.Row), 10))
		},
	)
	t.ShowHeaderRow = true
	t.CreateHeader = func() fyne.CanvasObject { return widget.NewLabel("Row") }
	t.UpdateHeader = func(id widget.TableCellID, template fyne.CanvasObject) {}
	w.SetContent(container.NewStack(t))
	w.Resize(fyne.Size{Width: 100, Height: 250})

	w.ShowAndRun()
}

Fyne version

2.5.0

Go compiler version

1.22.6

Operating system and version

Arch Linux

Additional Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions