Skip to content

Commit b4b892f

Browse files
authored
Merge pull request #343 from codesnippetspro/a11y-cloud-snippet-title
Fix: accessible title in cloud snippet search results
2 parents c0abbc8 + 05099e5 commit b4b892f

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

src/css/manage/_cloud-community.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,25 @@
8181

8282
.cloud-snippet {
8383
padding: 24px;
84+
85+
.cloud-snippet-title-button {
86+
display: inline;
87+
margin: 0;
88+
padding: 0;
89+
border: none;
90+
background: none;
91+
font: inherit;
92+
color: #2271b1;
93+
cursor: pointer;
94+
text-align: start;
95+
text-decoration: underline;
96+
97+
&:focus-visible {
98+
outline: 2px solid #2271b1;
99+
outline-offset: 2px;
100+
border-radius: 2px;
101+
}
102+
}
84103
}
85104

86105
.cloud-snippet-meta {

src/js/components/ManageMenu/CommunityCloud/SearchResults.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ interface CloudSnippetDetailsProps {
3030
const CloudSnippetDetails: React.FC<CloudSnippetDetailsProps> = ({ snippet, setIsPreviewOpen }) =>
3131
<div className="cloud-snippet">
3232
<h3>
33-
<a
34-
href="#"
33+
<button
34+
type="button"
35+
className="cloud-snippet-title-button"
3536
title={__('Preview this snippet', 'code-snippets')}
36-
onClick={event => {
37-
event.preventDefault()
37+
onClick={() => {
3838
setIsPreviewOpen(true)
3939
}}
4040
>
4141
{snippet.name}
42-
</a>
42+
</button>
4343
</h3>
4444

4545
<div className="cloud-snippet-meta">

0 commit comments

Comments
 (0)