Skip to content

Commit 90fddc3

Browse files
committed
[bugfix] Restore shift-click branch behaviour
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 <13424970+victorlin@users.noreply.github.com> 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(-) ```
1 parent 40d7b85 commit 90fddc3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/components/tree/phyloTree/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface Regression {
3535

3636
// ---------- Callbacks ---------- //
3737

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

4040
export interface Callbacks {
4141
onBranchClick: NodeCallback

src/components/tree/reactD3Interface/callbacks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export const onBranchClick = function onBranchClick(this: TreeComponent, d: Phyl
6161
if (this.props.narrativeMode) return;
6262

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

0 commit comments

Comments
 (0)