vaadin / vaadin/spreadsheet

Circular logic dependency when navigating cells via keyboard and using custom editor widgets

Open
#659 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
50
Forks
53
Avg merge
1d 21h
Merged PRs (30d)
1

Description

When a sheet is locked but has a few cells unlocked, and those cells have custom editors, the editor in a cell is not displayed when the selection is moved from a locked cell to an unlocked cell via the keyboard. Selecting the cell with the mouse does display the editor.

The problem is in SelectionHandler.onCellSelectedWithKeyboard(...). At the end it has these lines:

newSelectedCellSet();
spreadsheet.updateSelectedCellValues(column, row);

however, newSelectedCellSet() expects the selected cell values to already be changed, in particular the spreadsheet.cellLocked property. Since it still has the value from the previous selection, the logic doesn't flow properly.

However, just reversing the two lines causes a different problem, as the second line depends on the value of spreadsheet.customCellEditorDisplayed, which is set by the first call.

I have extended the component in my app to override the caller of this method and essentially repeat the first call after the second, but that's not the best solution. Since it works when clicking with the mouse, there should be a path to unifying the logic that behaves the same for keyboard and mouse navigation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in SelectionHandler.onCellSelectedWithKeyboard(...) and trace the interaction between newSelectedCellSet() and spreadsheet.updateSelectedCellValues(column, row), including spreadsheet.cellLocked and spreadsheet.customCellEditorDisplayed. Compare this path with mouse selection, then verify that keyboard navigation from a locked cell to an unlocked cell displays the custom editor consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.