[GH #7454] First column is hidden and user gets stuck there when pressing 'Home'

Tags: #<Tag:0x00007f34495b0a98> #<Tag:0x00007f34495b0958>

I have a table with a hidden column, when I press ‘Home’ I get taken to the first column and I can’t get out with the left/right arrow keys

Can I rebind ‘Home’ so it always goes to Column 1 instead of Column 0 ?

Hi @HC289

You can use the beforeKeyDown hook to change the default behavior of a keyboard.
You may start with event.stopImmediatePropagation() / event.preventDefault() and then you can attach your own logic with selectCell.

Hey @HC289

How’s the progress? Were you able to get the desired key behavior?

Sorry it took me so long and thanks Aleksandra. I’m using this to solve my issue - all feedback welcome:

  const beforeKeyDownHandler = evt => {
    // We're using a hidden first column for persisted metadata, the user gets stuck in it invisibly if they press 'home'
    // without this override
    if (evt.keyCode === 36) { // Home key
      let currentlySelectedCell = hotTableComponent().getSelected()[0][0]
      if (currentlySelectedCell) {
        hotTableComponent().selectCell(currentlySelectedCell, 1)
1 Like

@aleksandra_budnik Can you report this as a bug? Home key should move the active selection to the first rendered column (in the selected row) and allow arrow navigation.

Thank you for noticing @wojciech.czerniak You are right. And it seems to be a change in the behavior since.
7.4.2 https://jsfiddle.net/handsoncode/gbdrxmue/ moves the selection to the first visible cell
8.0.0 https://jsfiddle.net/handsoncode/gbdrxmue/1/ moves to A column which is hidden

Tested on Windows 10 / Chrome 87.

I’ve reported the issue on our Github board https://github.com/handsontable/handsontable/issues/7454 and will update you @HC289 once we get this done.