Skip to content

Commit

Permalink
[bugfix] Restore shift-click branch behaviour
Browse files Browse the repository at this point in the history
Clicking a branch while holding the shift-key should show an info modal.

Bisecting indicates that this regression occurred via

```
25294e8 is the first bad commit
commit 25294e8
Author: Victor Lin <[email protected]>
Date:   Fri Oct 25 16:11:34 2024 -0700

    Properly check window.event.shiftKey

    Only KeyboardEvent has the shiftKey property.

 src/components/tree/reactD3Interface/callbacks.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
```
  • Loading branch information
jameshadfield committed Nov 14, 2024
1 parent 40d7b85 commit 90fddc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/tree/phyloTree/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface Regression {

// ---------- Callbacks ---------- //

type NodeCallback = (d: PhyloNode) => void
type NodeCallback = (d: PhyloNode) => void // See <https://github.com/nextstrain/auspice/issues/1900>

export interface Callbacks {
onBranchClick: NodeCallback
Expand Down
4 changes: 3 additions & 1 deletion src/components/tree/reactD3Interface/callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export const onBranchClick = function onBranchClick(this: TreeComponent, d: Phyl
if (this.props.narrativeMode) return;

/* if a branch was clicked while holding the shift key, we instead display a node-clicked modal */
if (window.event instanceof KeyboardEvent && window.event.shiftKey) {
/* NOTE: window.event is deprecated, however the version of d3-selection we're using doesn't supply
the event as an argument */
if (window.event instanceof PointerEvent && window.event.shiftKey) {
// no need to dispatch a filter action
this.props.dispatch({type: SELECT_NODE, name: d.n.name, idx: d.n.arrayIdx, isBranch: true, treeId: d.that.id})
return;
Expand Down

0 comments on commit 90fddc3

Please sign in to comment.