Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround 1Password browser extension bug #1932

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/entropy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,12 @@ class Entropy extends React.Component {
width={this.props.width}
height={this.props.height}
>
<g ref={(c) => { this.d3entropy = c; }} id="d3entropy"/>
{/* TODO: remove intermediate <g>s once the 1Password extension interference is resolved
* <https://github.com/nextstrain/auspice/issues/1919>
*/}
<g><g><g><g>
<g ref={(c) => { this.d3entropy = c; }} id="d3entropy"/>
</g></g></g></g>
</svg>
{this.resetLayout(styles)}
{this.entropyCountSwitch(styles)}
Expand Down
7 changes: 6 additions & 1 deletion src/components/frequencies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ class Frequencies extends React.Component {
overflow: "visible"
}}
>
<g ref={(c) => { this.domRef = c; }} id="d3frequencies"/>
{/* TODO: remove intermediate <g>s once the 1Password extension interference is resolved
* <https://github.com/nextstrain/auspice/issues/1919>
*/}
<g><g><g><g>
<g ref={(c) => { this.domRef = c; }} id="d3frequencies"/>
</g></g></g></g>
</svg>
</Card>
);
Expand Down
5 changes: 4 additions & 1 deletion src/components/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ class Map extends React.Component {
this.state.responsive &&
!this.state.d3DOMNode
) {
const d3DOMNode = select("#map svg").attr("id", "d3DemesTransmissions");
/* TODO: remove intermediate <g>s once the 1Password extension interference is resolved
* <https://github.com/nextstrain/auspice/issues/1919>
*/
const d3DOMNode = select("#map svg").attr("id", "d3DemesTransmissions").append("g").append("g").append("g").append("g");
this.setState({d3DOMNode});
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/measurements/measurementsD3.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ export const drawMeasurementsSVG = (ref, xAxisRef, svgData) => {
// Do not draw SVG if there are no measurements
if (groupedMeasurements && groupedMeasurements.length === 0) return;

const svg = select(ref);

// The number of groups is the number of subplots, which determines the final SVG height
const totalSubplotHeight = (layout.subplotHeight * groupedMeasurements.length);
const svgHeight = totalSubplotHeight + layout.topPadding;
svg.attr("height", svgHeight);
/* TODO: remove intermediate <g>s once the 1Password extension interference is resolved
* <https://github.com/nextstrain/auspice/issues/1919>
*/
const svg = select(ref).attr("height", svgHeight).append("g").append("g").append("g").append("g");

// x-axis is in a different SVG element to allow sticky positioning
drawStickyXAxis(xAxisRef, containerHeight, svgHeight, xScale, x_axis_label);
Expand Down
4 changes: 2 additions & 2 deletions src/components/tree/phyloTree/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const svgSetters = {
};


type UpdateCall = (selection: Transition<SVGGElement, PhyloNode, SVGSVGElement | null, unknown>) => void;
type UpdateCall = (selection: Transition<SVGGElement, PhyloNode, SVGGElement | null, unknown>) => void;


/** createUpdateCall
Expand Down Expand Up @@ -111,7 +111,7 @@ function createUpdateCall(
}

const genericSelectAndModify = (
svg: Selection<SVGSVGElement | null, unknown, null, unknown>,
svg: Selection<SVGGElement | null, unknown, null, unknown>,
treeElem: TreeElement,
updateCall: UpdateCall,
transitionTime: number,
Expand Down
1 change: 1 addition & 0 deletions src/components/tree/phyloTree/layouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ export const setScales = function setScales(this: PhyloTreeType): void {
this.yScale = scaleLinear();
}

// TODO: access these from d3treeParent so they don't have to be set twice
const width = parseInt(this.svg.attr("width"), 10);
const height = parseInt(this.svg.attr("height"), 10);
if (this.layout === "radial" || this.layout === "unrooted") {
Expand Down
4 changes: 2 additions & 2 deletions src/components/tree/phyloTree/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const render = function render(
dateRange,
scatterVariables
}: {
/** the svg into which the tree is drawn */
svg: Selection<SVGSVGElement | null, unknown, null, unknown>
/** the SVG element into which the tree is drawn */
svg: Selection<SVGGElement | null, unknown, null, unknown>

/** the layout to be used, e.g. "rect" */
layout: Layout
Expand Down
2 changes: 1 addition & 1 deletion src/components/tree/phyloTree/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export interface PhyloTreeType {
setScales: typeof layouts.setScales
showTemporalSlice: typeof grid.showTemporalSlice
strainToNode: Record<string, PhyloNode>
svg: Selection<SVGSVGElement | null, unknown, null, unknown>
svg: Selection<SVGGElement | null, unknown, null, unknown>
timeLastRenderRequested?: number
unrootedLayout: typeof layouts.unrootedLayout
updateBranchLabels: typeof labels.updateBranchLabels
Expand Down
21 changes: 16 additions & 5 deletions src/components/tree/tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const rhsTreeId = "RIGHT";
export class TreeComponent extends React.Component<TreeComponentProps, TreeComponentState> {

domRefs: {
mainTree: SVGSVGElement | null;
secondTree: SVGSVGElement | null;
mainTree: SVGGElement | null;
secondTree: SVGGElement | null;
};
tangleRef?: Tangle;
clearSelectedNode: (node: SelectedNode) => void;
Expand Down Expand Up @@ -186,12 +186,23 @@ export class TreeComponent extends React.Component<TreeComponentProps, TreeCompo
}) {
return (
<svg
id={mainTree ? "MainTree" : "SecondTree"}
id="d3treeParent"
style={{pointerEvents: "auto", cursor: "default", userSelect: "none"}}
width={width}
height={height}
ref={(c) => {mainTree ? this.domRefs.mainTree = c : this.domRefs.secondTree = c;}}
/>
>
{/* TODO: remove intermediate <g>s once the 1Password extension interference is resolved
* <https://github.com/nextstrain/auspice/issues/1919>
*/}
<g><g><g><g>
<g
id={mainTree ? "MainTree" : "SecondTree"}
width={width}
height={height}
ref={(c) => {mainTree ? this.domRefs.mainTree = c : this.domRefs.secondTree = c;}}
/>
</g></g></g></g>
</svg>
);
}

Expand Down
Loading