Skip to content

Commit b066366

Browse files
committed
Use button instead of a for compare table queries
1 parent 493c9cb commit b066366

3 files changed

Lines changed: 26 additions & 32 deletions

File tree

extensions/ql-vscode/src/view/common/TextButton.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ const StyledButton = styled.button<{ size: Size }>`
88
color: var(--vscode-textLink-foreground);
99
border: none;
1010
cursor: pointer;
11-
font-size: ${(props) => props.size};
11+
font-size: ${(props) => props.size ?? "1em"};
1212
`;
1313

1414
const TextButton = ({
1515
size,
1616
onClick,
17+
className,
1718
children,
1819
}: {
19-
size: Size;
20+
size?: Size;
2021
onClick: () => void;
22+
className?: string;
2123
children: React.ReactNode;
2224
}) => (
23-
<StyledButton size={size} onClick={onClick}>
25+
<StyledButton size={size} onClick={onClick} className={className}>
2426
{children}
2527
</StyledButton>
2628
);

extensions/ql-vscode/src/view/compare/CompareTable.tsx

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ import { ResultRow } from "../../common/bqrs-cli-types";
77
import RawTableRow from "../results/RawTableRow";
88
import { vscode } from "../vscode-api";
99
import { sendTelemetry } from "../common/telemetry";
10+
import TextButton from "../common/TextButton";
11+
import { styled } from "styled-components";
1012

1113
interface Props {
1214
comparison: SetComparisonsMessage;
1315
}
1416

17+
const OpenButton = styled(TextButton)`
18+
cursor: pointer;
19+
text-decoration: underline;
20+
padding: 0;
21+
`;
22+
1523
export default function CompareTable(props: Props) {
1624
const comparison = props.comparison;
1725
const rows = props.comparison.rows!;
@@ -46,32 +54,14 @@ export default function CompareTable(props: Props) {
4654
<thead>
4755
<tr>
4856
<td>
49-
{/*
50-
eslint-disable-next-line
51-
jsx-a11y/anchor-is-valid,
52-
jsx-a11y/click-events-have-key-events,
53-
jsx-a11y/no-static-element-interactions
54-
*/}
55-
<a
56-
onClick={() => openQuery("from")}
57-
className="vscode-codeql__compare-open"
58-
>
57+
<OpenButton onClick={() => openQuery("from")}>
5958
{comparison.stats.fromQuery?.name}
60-
</a>
59+
</OpenButton>
6160
</td>
6261
<td>
63-
{/*
64-
eslint-disable-next-line
65-
jsx-a11y/anchor-is-valid,
66-
jsx-a11y/click-events-have-key-events,
67-
jsx-a11y/no-static-element-interactions
68-
*/}
69-
<a
70-
onClick={() => openQuery("to")}
71-
className="vscode-codeql__compare-open"
72-
>
62+
<OpenButton onClick={() => openQuery("to")}>
7363
{comparison.stats.toQuery?.name}
74-
</a>
64+
</OpenButton>
7565
</td>
7666
</tr>
7767
<tr>

extensions/ql-vscode/src/view/results/resultsView.css

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,15 @@
8484
.vscode-codeql__result-table th {
8585
border-top: 1px solid rgba(88, 96, 105, 0.25);
8686
border-bottom: 1px solid rgba(88, 96, 105, 0.25);
87-
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial,
88-
sans-serif, Apple Color Emoji, Segoe UI Emoji;
87+
font-family:
88+
-apple-system,
89+
BlinkMacSystemFont,
90+
Segoe UI,
91+
Helvetica,
92+
Arial,
93+
sans-serif,
94+
Apple Color Emoji,
95+
Segoe UI Emoji;
8996
background: rgba(225, 228, 232, 0.25);
9097
padding: 0.25em 0.5em;
9198
text-align: center;
@@ -225,11 +232,6 @@ td.vscode-codeql__path-index-cell {
225232
width: 100%;
226233
}
227234

228-
.vscode-codeql__compare-open {
229-
cursor: pointer;
230-
text-decoration: underline;
231-
}
232-
233235
.vscode-codeql__compare-body > tbody {
234236
vertical-align: top;
235237
}

0 commit comments

Comments
 (0)