[GH #5906] Context Menu and Column Headers - right click header based on previous cell selection

Tags: #<Tag:0x00007fbe8c46c560> #<Tag:0x00007fbe8c46c420>

I think this is a bug. It also happens on the handsontable website demo.

If you select a cell in the first row then right click the header, it does not select the whole column.

If you select any other row’s column and then right click the header, it selects the whole column.

See this screen cast (might have to enable flash): https://www.screencast.com/t/dgVegI77guu

Side note / Question:
Is there a method i can use to identify if a context menu was opened from a regular cell or a header cell? The reason i ask is because I’m trying to add a column rename input to the context menu, but only show it if the header was clicked. The bug reported is interfering with my workaround to achieve this (my workaround involves using the selected column index and looking for the class “ht__active_highlight”). Using selections does not help - the user could manually select all cells in a column, then right click for the context menu which is not the same as right clicking the header.

EDIT: To quote the documentation “Context menu with default options”: “Likewise, when the context menu for the column header is opened, the row options are disabled” - It looks like this uses selections too - and is also effected by the bug.

Thank you for sharing this bug scenario. It looks like this one (it just the different direction of clicks) https://github.com/handsontable/handsontable/issues/5906
I will update you once we fix this issue.

Great. Thanks.

Just to check, am i reporting these in the wrong place? (should i use GitHub in the future?)


It depends :wink:

GitHub is for reporting the bug.
For help, the better place is the forum.

OK great, I’ll report bugs on the GitHub in the future. Thanks.

EDIT: If anyone else is interested, I’ve been incorrectly one of the 4 hot.getSelected() / getSelectedLast() / getSelectedRange() / getSelectedRangeLast() to get selections in the past. You use hot.selection (accessing the object not calling one of the functions) which has purpose built functions isSelectedByColumnHeader() and isSelectedByRowHeader(). It still suffers from the bug though.
e.g. hot.selection.isSelectedByColumnHeader().

Hi @stephen.longville

I have good news! We’ve just released 8.0.0-beta2 that fixes the mentioned issue. We won’t be closing this ticket now. It will be closed after we release the final 8.0.0 version of Handsontable.

Here’s a full list of changes https://github.com/handsontable/handsontable/releases/tag/8.0.0-beta.2
NPM https://www.npmjs.com/package/handsontable/v/8.0.0-beta.2

All feedback’s appreciated. Thank you for your input.

1 Like