Skip to content

Commit 8cd4b25

Browse files
wolfibDevtools-frontend LUCI CQ
authored andcommitted
Make citations keyboard-accessible
By switching from <x-link> to <button>, the action can now be triggered via keyboard as well. Bug: 393061324 Change-Id: I70ec9193c286be1c84ea136e2a5a001491169a0d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6310995 Auto-Submit: Wolfgang Beyer <[email protected]> Commit-Queue: Alex Rudenko <[email protected]> Reviewed-by: Alex Rudenko <[email protected]>
1 parent ecb54ac commit 8cd4b25

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

front_end/panels/explain/components/ConsoleInsight.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ describeWithEnvironment('ConsoleInsight', () => {
363363

364364
assert.isFalse(details?.hasAttribute('open'));
365365
assert.isFalse(directCitations[0].classList.contains('highlighted'));
366-
const link = markdownView!.shadowRoot?.querySelector('sup x-link') as HTMLElement;
366+
const link = markdownView!.shadowRoot?.querySelector('sup button') as HTMLElement;
367367
link.click();
368368
assert.isTrue(details?.hasAttribute('open'));
369369
assert.isTrue(directCitations[0].classList.contains('highlighted'));

front_end/ui/components/markdown_view/MarkdownView.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,11 @@ export class MarkdownInsightRenderer extends MarkdownLitRenderer {
352352
</devtools-code-block>`;
353353
case 'citation':
354354
// clang-format off
355-
return html`<sup><x-link
356-
class="devtools-link"
355+
return html`<sup><button
356+
class="citation"
357357
jslog=${VisualLogging.link('inline-citation').track({click: true})}
358358
@click=${this.#citationClickHandler.bind(this, Number(token.linkText))}
359-
>[${token.linkText}]</x-link></sup>`;
359+
>[${token.linkText}]</button></sup>`;
360360
// clang-format on
361361
}
362362
return super.templateForToken(token as Marked.Marked.MarkedToken);

front_end/ui/components/markdown_view/markdownView.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ devtools-code-block {
8282
margin-bottom: var(--sys-size-5);
8383
}
8484

85-
.devtools-link {
86-
color: var(--sys-color-primary);
87-
outline-offset: 2px;
85+
.citation {
8886
text-decoration: underline;
87+
color: var(--sys-color-primary);
88+
background-color: transparent;
8989
cursor: pointer;
90+
outline-offset: var(--sys-size-2);
91+
border: none;
92+
padding: 0;
93+
font-size: 10px;
94+
font-family: var(--default-font-family);
9095
}
9196

9297
h1.insight, h2.insight, h3.insight, h4.insight, h5.insight, h6.insight {

0 commit comments

Comments
 (0)