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

Tags: #<Tag:0x00007fa999443b18> #<Tag:0x00007fa999443988>

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?)

Cheers,
Steve.

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().