From: 7PH Date: Thu, 15 Aug 2024 08:43:56 +0000 (+0200) Subject: SONAR-22287 Fix a11y issues on Background Tasks page X-Git-Tag: 10.7.0.96327~226 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=563a8712bf5ca5a67cf00f730944b2715454be65;p=sonarqube.git SONAR-22287 Fix a11y issues on Background Tasks page --- diff --git a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx index c984c2a9b74..338205bfae1 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx @@ -410,7 +410,11 @@ function getPageObject() { async clickOnTaskAction(rowIndex: number, label: string) { const row = ui.getAllRows()[rowIndex]; expect(row).toBeVisible(); - await user.click(within(row).getByRole('button', { name: 'background_tasks.show_actions' })); + await user.click( + within(row).getByRole('button', { + name: `background_tasks.show_actions_for_task_x_in_list.${rowIndex}`, + }), + ); await user.click(within(row).getByRole('menuitem', { name: label })); }, }; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/AnalysisWarningsModal.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/AnalysisWarningsModal.tsx index 31295c6c1ad..3671ee2f0f8 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/AnalysisWarningsModal.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/AnalysisWarningsModal.tsx @@ -112,39 +112,41 @@ export class AnalysisWarningsModal extends React.PureComponent { const body = ( - {warnings.map(({ dismissable, key, message }) => ( - -
- - - ')), - }} - /> - - -
-
- {dismissable && currentUser.isLoggedIn && ( -
- - - -
- )} -
-
- ))} +
    + {warnings.map(({ dismissable, key, message }) => ( +
  • +
    + + + ')), + }} + /> + + +
    +
    + {dismissable && currentUser.isLoggedIn && ( +
    + + + +
    + )} +
    +
  • + ))} +
); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx index ab722b4f0f6..dbb564cb9c5 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx @@ -35,10 +35,11 @@ interface Props { onCancelTask: (task: ITask) => Promise; onFilterTask: (task: ITask) => void; task: ITask; + taskIndex: number; } export default function Task(props: Readonly) { - const { task, component, onCancelTask, onFilterTask } = props; + const { task, component, taskIndex, onCancelTask, onFilterTask } = props; const appState = React.useContext(AppStateContext); const isDataCenter = appState.edition === EditionKey.datacenter; @@ -54,6 +55,7 @@ export default function Task(props: Readonly) { Promise; onFilterTask: (task: Task) => void; task: Task; + taskIndex: number; } interface State { @@ -89,7 +90,7 @@ export default class TaskActions extends React.PureComponent { }; render() { - const { component, task } = this.props; + const { component, task, taskIndex } = this.props; const canFilter = component === undefined && task.componentName; const canCancel = task.status === TaskStatuses.Pending; @@ -106,7 +107,10 @@ export default class TaskActions extends React.PureComponent { {canFilter && task.componentName && ( diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx index 274803fa07e..2c0171ec3de 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx @@ -59,10 +59,11 @@ export function Tasks({ tasks, component, onCancelTask, onFilterTask }: Readonly } > - {tasks.map((task) => ( + {tasks.map((task, index) => (