Skip to content

Commit 64db60a

Browse files
vinokurigclaude
andauthored
fix(a11y): replace nested anchor in button with onClick handler (#1554)
* fix(a11y): replace nested anchor in button with onClick handler Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * test: update snapshot for RegistryUrl component Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1e89ab1 commit 64db60a

2 files changed

Lines changed: 21 additions & 28 deletions

File tree

packages/dashboard-frontend/src/pages/UserPreferences/ContainerRegistriesTab/RegistryUrl/__tests__/__snapshots__/index.spec.tsx.snap

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,37 +68,27 @@ exports[`Registry Url Input should correctly render the component 1`] = `
6868
data-ouia-component-type="PF6/Button"
6969
data-ouia-safe={true}
7070
disabled={true}
71+
onClick={[Function]}
7172
tabIndex={null}
7273
type="button"
7374
>
7475
<span
7576
className="pf-v6-c-button__text"
7677
>
77-
<a
78-
href="https://ttt"
79-
rel="noreferrer"
80-
style={
81-
{
82-
"color": "inherit",
83-
}
84-
}
85-
target="_blank"
78+
<svg
79+
aria-hidden={true}
80+
aria-labelledby={null}
81+
className="pf-v6-svg"
82+
fill="currentColor"
83+
height="1em"
84+
role="img"
85+
viewBox="0 0 512 512"
86+
width="1em"
8687
>
87-
<svg
88-
aria-hidden={true}
89-
aria-labelledby={null}
90-
className="pf-v6-svg"
91-
fill="currentColor"
92-
height="1em"
93-
role="img"
94-
viewBox="0 0 512 512"
95-
width="1em"
96-
>
97-
<path
98-
d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"
99-
/>
100-
</svg>
101-
</a>
88+
<path
89+
d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"
90+
/>
91+
</svg>
10292
</span>
10393
</button>
10494
</div>

packages/dashboard-frontend/src/pages/UserPreferences/ContainerRegistriesTab/RegistryUrl/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,13 @@ export class RegistryUrlFormGroup extends React.PureComponent<Props, State> {
109109
validated={valid}
110110
onChange={(_event, _url) => this.onChange(_url)}
111111
/>
112-
<Button variant="link" isDisabled={!url || !isUrl} aria-label="open registry">
113-
<a href={url} style={{ color: 'inherit' }} target="_blank" rel="noreferrer">
114-
<ExternalLinkAltIcon />
115-
</a>
112+
<Button
113+
variant="link"
114+
isDisabled={!url || !isUrl}
115+
aria-label="open registry"
116+
onClick={() => window.open(url, '_blank')}
117+
>
118+
<ExternalLinkAltIcon />
116119
</Button>
117120
</InputGroup>
118121
{valid === ValidatedOptions.error && errorMessage && (

0 commit comments

Comments
 (0)