diff options
author | Ismail Cherri <ismail.cherri@sonarsource.com> | 2024-02-23 10:25:43 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-02-23 20:02:35 +0000 |
commit | c2499586a8539c3dc9d7c051418a159d58169972 (patch) | |
tree | 31c7c7138091e90863276b7380a204dbddc1c081 /server/sonar-web/src/main/js/apps/issues/issues-subnavigation/IssueLocation.tsx | |
parent | b312363fc8736cf2d38103d5fc6f97328e85a109 (diff) | |
download | sonarqube-c2499586a8539c3dc9d7c051418a159d58169972.tar.gz sonarqube-c2499586a8539c3dc9d7c051418a159d58169972.zip |
SONAR-21692 Fix jest warnings related to Valid DOM in IssuesApp (#10695)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/issues/issues-subnavigation/IssueLocation.tsx')
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/issues-subnavigation/IssueLocation.tsx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/IssueLocation.tsx b/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/IssueLocation.tsx index c2414f6579b..a1d910f2eb5 100644 --- a/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/IssueLocation.tsx +++ b/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/IssueLocation.tsx @@ -19,7 +19,7 @@ */ import styled from '@emotion/styled'; import classNames from 'classnames'; -import { BaseLink, LocationMarker, StyledMarker, themeColor } from 'design-system'; +import { LocationMarker, StyledMarker, themeColor } from 'design-system'; import React, { useCallback, useEffect, useMemo, useRef } from 'react'; import { translate } from '../../../helpers/l10n'; @@ -31,7 +31,7 @@ interface Props { selected: boolean; } -export default function IssueLocation(props: Props) { +export default function IssueLocation(props: Readonly<Props>) { const { index, message, selected, concealed, onClick } = props; const node = useRef<HTMLElement | null>(null); const locationType = useMemo(() => getLocationType(message), [message]); @@ -47,7 +47,7 @@ export default function IssueLocation(props: Props) { }, [selected]); const handleClick = useCallback( - (event: React.MouseEvent<HTMLAnchorElement>) => { + (event: React.MouseEvent<HTMLButtonElement>) => { event.preventDefault(); onClick(index); }, @@ -55,12 +55,7 @@ export default function IssueLocation(props: Props) { ); return ( - <StyledLink - aria-label={normalizedMessage} - aria-current={selected} - onClick={handleClick} - to={{}} - > + <StyledButton aria-label={normalizedMessage} aria-current={selected} onClick={handleClick}> <StyledLocation className={classNames('sw-p-1 sw-rounded-1/2 sw-flex sw-gap-2 sw-body-sm', { selected, @@ -81,7 +76,7 @@ export default function IssueLocation(props: Props) { </StyledLocationName> </span> </StyledLocation> - </StyledLink> + </StyledButton> ); } @@ -96,9 +91,10 @@ const StyledLocation = styled.div` } `; -const StyledLink = styled(BaseLink)` +const StyledButton = styled.button` color: ${themeColor('pageContent')}; border: none; + background: none; `; const StyledLocationName = styled.span` |