[8.0.0] ctrl-a no longer displays custom row context menu items

Tags: #<Tag:0x00007efc64e71898>

With 7.4.2 ctrl-a would select all rows including column headers and would display the default Hide Columns | Show Columns context menu items along with any custom context menu items depending on row header selection. With 8.0.0 only only the Hide Columns | Show Columns menu options are available. I know there is another forms issue Cannot remove rows after CTRL+A keyboard shortcut that is similar but even with an overwrite on the keyboard combination it still does not work because when trying to select the row header to view the custom context menu items it unselects all the rows selected by ctrl-a. It seems like the solution when selecting all rows with ctrl-a would be to select the row header as well. I tried to pass selectCell a -1 for starting column position and that does not seem to work. Any insight would be greatly appreciated.

Hi @davbro80129

There have been some changes for the selection made in v8.0.0 https://handsontable.com/docs/8.0.0/tutorial-migration-guide.html

Please let me know if you experience anything more than described in the guide using v8.0.0. Definitely a demo with a step-by-step scenario would help me to replicate the same issue on my device.

The following jsfiddle illustrates the problem when using 8.0.0. It will run with both versions and is currently using 7.4.2 which displays the custom context menu item after entering ctrl-a. Comment the 7.4.2 cdn link and uncomment the 8.0.0 cdn links to see the issue. With 8.0.0 the custom menu option is not displayed.

https://jsfiddle.net/davbro/1dapqbLt/40/

Hi @davbro80129 that is not an issue. As mentioned in the migration guide since v 8.0.0 when we use CTRL/CMD + A we select data along with headers. You can check it by calling afterSelectionEnd hook.

Can you please advise with the 8.0.0 version how I can display the custom context menu items after selecting CTRL-A like it did in 7.4.2? That is fine that it selects the headers but in the 8.0.0 version it seems that it only selects the column headers and not the row headers. Thanks again for you time.

I updated the jsfiddle example with the afterSelectionEnd hook and did confirm with version 8.0.0 that the starting column index was -1 so I am not sure why the context menu does not display the option?

https://jsfiddle.net/davbro/1dapqbLt/latest/

result of entering ctrl-a in version 7.4.2

  • “afterSelectionEnd startRow: 0 startCol: 0”
  • “isSelectedByColumnHeader: true”
  • “isSelectedByRowHeader: true”
  • “isSelectedByCorner: true”
    *** isEntireRowSeleted not in 7.4.2

result of entering ctrl-a in version 8.0.0

  • “afterSelectionEnd startRow: -1 startCol: -1”
  • “isSelectedByColumnHeader: false”
  • “isSelectedByRowHeader: false”
  • “isSelectedByCorner: true”
  • “isEntireRowSelected: true”

Hi @davbro80129

I wanted to make a short update.

  • The isSelectedByRowHeader indicates if the row is selected by click event made on the row index -1 (row header). For CTRL/CMD + A this method returns false.

  • The isSelectedByRowHeader returns false for the top-left element (I’d need to check that in our specification).

  • when clicked on row header we get option_1 but when we click any further cell in that row we get browser context menu and our menu is still opened (this seems to be a bug).

  • when we click CTRL/CMD + A and then click any header with RMB we still do not get option_1 (this also looks like a bug)

I will investigate those scenarios and come back to you with an update.

Hi @davbro80129

I’ve reported the issue with the scenario when all cells are selected the isSelectedByRowHeader value is not updated https://github.com/handsontable/handsontable/issues/7271
I will notify you when it is fixed.

When it comes to showing an option for the header you can also use

hot.getSelectedRangeLast().to.row > 0;

ps. I’ve also reported the issue with the lack of change for the isSelectedByRowHeader when we click row header and then proceed with clicking its cells https://github.com/handsontable/handsontable/issues/7272

I will make sure to update you o both of these topics.

Thanks again, for looking into the issues.

Hi @davbro80129

our CTO updated me on the subject

RMB on selected range doesn’t change the selection. The selection was made earlier and not byRowHeader .
If you select something by CMD/CTRL + A then the selection is made by both, row and column, headers. isSelectedByRowHeader is true only when the selection was made by row header.
Not a bug.

What is the desired result here? isSelectedByRowHeader is true when rows were selected by rows ONLY. Similar situation for isSelectedByColumnHeader. If all cells are selected by corner click or CTRL+A then you have iisSelectedByCorner method.

If I understood the use case correctly the migration to v8 would be:

hidden: function() {
  // do not display option if row header not selected
  return !this.selection.isSelectedByRowHeader() && !this.selection.isSelectedByCorner(); 
},

In both cases the selected range contains whole rows so they may be removed.

The desired result is to have it still work like it did in 7.4.2 displaying the row and column custom context menu options when selecting ctrl-a or the upper left corner. I am not sure why when selecting the entire table by ctrl-a or the upper left corner it does not not indicate row and column headers are selected because getSelected returns -1 for both row and column starting points. I understand that this is part of the migration to version 8.0.0 and I have found a work around to the issue. Thanks again for looking into this.

1 Like