Improving selection behaviour

Hi there,

We have a requirement to make cell selection behaviour more predictable for merged cells, unfortunately I’m not sure if creating a custom selection class would solve this. I’m thinking it might require changes in the core Selection class.

Please consider the following example:

The desired behaviour would be to select only 1,4 and 7 cells when selecting the first column.

The ultimate goal is to render rectangular overlay on top of all selected cells (as opposed to adding a selected classname), so that in the last example cell 7 should be partially selected (visually select only the first colspan out of 3 for the first column, second colspan for the second column etc).

Would that be possible to achieve by creating a custom selection class? If not, would you @marijn consider making a change in core Selection class to control this behaviour?


The table cell selection that you’re seeing in the screencast is a custom selection class. If I remember correctly, I implemented that to try and make the selection rectangular when possible, which is why cells 2,3,5,6 end up selected, but maybe there’s another reasonable heuristic you could use there.

Sorry, I forgot to mention that I’ve already tried hacking CellSelection and it didn’t quite work, but I just realised where I made a mistake.

I’m going to spike it now and share the results.Thanks!