I have this selection of multiple cells in a table while the control key must be pressed in order to select all the clicked cells:
cy.get("[data-cy=cell-1],[data-cy=cell-5],[data-cy=cell-32]")
.click({ multiple: true, ctrlKey: true})
It works well, I see the multiple selection since selected cells have a different background color. I coded the page so when the window:keyup event on the control key happens, a dialog opens to edit the cells content. This works very well on dev, but with cypress, the .click({ multiple: true, ctrlKey: true}) doesn't trigger my dialog, and if I had a manual .type({ctrl}) after, it triggers the dialog but the multiple selection is lost
cy.get("[data-cy=cell-1],[data-cy=cell-5],[data-cy=cell-32]")
.click({ multiple: true, ctrlKey: true})
cy.get("#my-table-container").type("{ctrl}")
It acts like for my first click({multiple: true, ctrlKey: true}) the control key is down but never released. Do you know how could I use the click multiple and control but triggering the keyup at the end?
UPDATE: @HostListener setup I am on Angular 12, here is exactly how I setup the key event with the @HostListener (I also listen the escape key to clear the cell selection):
@HostListener("window:keyup", ["$event"])
handleKeyDown(event: KeyboardEvent) {
switch(event.key){
case "Escape": this.clearSelection(); break;
case "Control":this.openEditDialog(); break;
}
}