]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16731 [891660] Programmatic label does not convey purpose of control
authorJeremy Davis <jeremy.davis@sonarsource.com>
Fri, 5 Aug 2022 12:32:17 +0000 (14:32 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 8 Aug 2022 20:03:03 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap
server/sonar-web/src/main/js/components/controls/ListFooter.tsx
server/sonar-web/src/main/js/components/controls/buttons.tsx
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index d7de7ef7727250f958d07d790b3d968901957aca..b2a000ba1b2409c1f956e68b53609655bbf019f7 100644 (file)
@@ -265,6 +265,7 @@ export class AllProjects extends React.PureComponent<Props, State> {
           />
         )}
         <ListFooter
+          accessibleLoadMoreLabel={translate('projects.show_more')}
           count={this.state.projects !== undefined ? this.state.projects.length : 0}
           loading={this.state.loading}
           loadMore={this.fetchMoreProjects}
index e5bddc372ab9db9f72900f51f21b3a30af199528..5bc0159cb695c1333bc6ec1e7f03c014f331f1bd 100644 (file)
@@ -170,6 +170,7 @@ exports[`renders 1`] = `
           }
         />
         <ListFooter
+          accessibleLoadMoreLabel="projects.show_more"
           count={1}
           loadMore={[Function]}
           loading={false}
index 3f2aaac7ba6c14133d47611ad5ceb1d0d7a794f9..1d4c87869776c8d0a22d0d1bb4f07b2485c2862c 100644 (file)
@@ -25,6 +25,7 @@ import DeferredSpinner from '../ui/DeferredSpinner';
 import { Button } from './buttons';
 
 export interface ListFooterProps {
+  accessibleLoadMoreLabel?: string;
   count: number;
   className?: string;
   loading?: boolean;
@@ -37,7 +38,16 @@ export interface ListFooterProps {
 }
 
 export default function ListFooter(props: ListFooterProps) {
-  const { className, count, loading, needReload, total, pageSize, ready = true } = props;
+  const {
+    accessibleLoadMoreLabel,
+    className,
+    count,
+    loading,
+    needReload,
+    total,
+    pageSize,
+    ready = true
+  } = props;
 
   let hasMore = false;
   if (total !== undefined) {
@@ -56,6 +66,7 @@ export default function ListFooter(props: ListFooterProps) {
   } else if (hasMore && props.loadMore) {
     button = (
       <Button
+        aria-label={accessibleLoadMoreLabel}
         className="spacer-left"
         disabled={loading}
         data-test="show-more"
index 8c0aa493d2a45ba60b79b7dcf1bf722c9b6f6ea4..e4cf225e3f1335fee4512e3fca086892de5de60c 100644 (file)
@@ -30,7 +30,7 @@ import Tooltip, { TooltipProps } from './Tooltip';
 
 type AllowedButtonAttributes = Pick<
   React.ButtonHTMLAttributes<HTMLButtonElement>,
-  'className' | 'disabled' | 'id' | 'style' | 'title'
+  'aria-label' | 'className' | 'disabled' | 'id' | 'style' | 'title'
 >;
 
 interface ButtonProps extends AllowedButtonAttributes {
index 0a81ba4f272c53ff66dc11990e57f9950c7d2028..ee93a308e00893584f2a2962f944145bc57ab7cd 100644 (file)
@@ -1108,7 +1108,7 @@ projects.sort.duplications=by duplications (best first)
 projects.sort.-duplications=by duplications (worst first)
 projects.sort.size=by size (smallest first)
 projects.sort.-size=by size (biggest first)
-
+projects.show_more=Show more projects
 projects.security_hotspots_reviewed=Hotspots Reviewed
 
 #------------------------------------------------------------------------------