From: Guillaume Peoc'h Date: Thu, 25 Aug 2022 09:18:12 +0000 (+0200) Subject: SONAR-16883 [892274] State: Selected state of the element is missing or incorrect X-Git-Tag: 9.7.0.61563~315 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=80f9f4bb93886c225a1ad9c438c897ce527a97d3;p=sonarqube.git SONAR-16883 [892274] State: Selected state of the element is missing or incorrect --- diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.css b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.css index 8acd471775d..e53ded9e754 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.css +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.css @@ -61,9 +61,11 @@ border: 1px solid transparent; border-top-color: var(--barBorderColor); transition: padding 0s, border 0s; + max-width: 100%; + text-align: left; } -a.hotspot-item:focus { +button.hotspot-item:focus { color: var(--baseFontColor); } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx index 1df6caa33f4..23135c4f6af 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx @@ -19,6 +19,7 @@ */ import classNames from 'classnames'; import * as React from 'react'; +import { ButtonPlain } from '../../../components/controls/buttons'; import QualifierIcon from '../../../components/icons/QualifierIcon'; import LocationsList from '../../../components/locations/LocationsList'; import { ComponentQualifier } from '../../../types/component'; @@ -40,14 +41,15 @@ export default function HotspotListItem(props: HotspotListItemProps) { const path = getFilePath(hotspot.component, hotspot.project); return ( - !selected && props.onClick(hotspot)}> + {/* This is not a real interaction it is only for scrolling */ + /* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
props.onLocationClick() : undefined} - role={selected ? 'button' : undefined}> + onClick={selected ? () => props.onLocationClick() : undefined}> {hotspot.message}
@@ -67,6 +69,6 @@ export default function HotspotListItem(props: HotspotListItemProps) { scroll={props.onScroll} /> )} - + ); } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotListItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotListItem-test.tsx.snap index 0d13bbb6774..b9a3f92bbbf 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotListItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotListItem-test.tsx.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render correctly 1`] = ` -
- + `; exports[`should render correctly 2`] = ` -
'3' is a magic number.
@@ -63,5 +62,5 @@ exports[`should render correctly 2`] = ` onLocationSelect={[Function]} scroll={[MockFunction]} /> -
+ `;