From 2d1fce5df5937c9679e27cab91ce4edbb4781cc2 Mon Sep 17 00:00:00 2001 From: Josiah Hoskins Date: Tue, 26 Mar 2024 13:31:57 -0500 Subject: [PATCH 1/4] fix hidden counts again --- .../src/ts/devtools/components/scanSection.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx b/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx index 2b45d99f0..da1377b6a 100644 --- a/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx +++ b/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx @@ -21,7 +21,7 @@ import { UtilIssue } from '../../util/UtilIssue'; import { UtilIssueReact } from '../../util/UtilIssueReact'; import { getDevtoolsController, ScanningState, ViewState } from '../devtoolsController'; import { getTabId } from '../../util/tabId'; -import { getBGController, TabChangeType } from '../../background/backgroundController'; +import { getBGController, issueBaselineMatch, TabChangeType } from '../../background/backgroundController'; import { Button, Column, @@ -252,6 +252,7 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { getCounts(issues: UIIssue[] | null) : CountType { let counts = this.initCount(); + if (!issues) return counts; if (issues) { for (const issue of issues) { let sing = UtilIssue.valueToStringSingular(issue.value); @@ -263,11 +264,11 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { } if (this.state.ignoredIssues) { for (const ignoredIssue of this.state.ignoredIssues) { + if (!issues.some(issue => issueBaselineMatch(issue, ignoredIssue))) continue; ++counts["Hidden" as eLevel].total; if (!this.state.selectedPath || ignoredIssue.path.dom.startsWith(this.state.selectedPath)) { ++counts["Hidden" as eLevel].focused; } - // remove from appropriate eLevel V, NR, R let sing = UtilIssue.valueToStringSingular(ignoredIssue.value); --counts[sing as eLevel].total; if (!this.state.selectedPath || ignoredIssue.path.dom.startsWith(this.state.selectedPath)) { @@ -293,6 +294,7 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { } if (reportIssues) { filterCounts = this.getCounts(reportIssues); + console.log("scan section filterCounts = ",filterCounts); reportIssues = reportIssues.filter((issue: IIssue) => { let retVal = (this.state.checked[UtilIssue.valueToStringSingular(issue.value) as eLevel] && (!this.state.focusMode @@ -483,7 +485,11 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { {UtilIssueReact.valueSingToIcon(BrowserDetection.isDarkMode()?"ViewOn":"ViewOff", "reportSecIcon")} {reportIssues && <> - {this.state.ignoredIssues.length} + {(filterCounts["Hidden"].focused === filterCounts["Hidden"].total) ? + filterCounts["Hidden"].total + : <> + {filterCounts["Hidden"].focused}/{filterCounts["Hidden"].total} + } } From 746be7fbe44a5d4337b7bc53f29b0a0fcc9746c2 Mon Sep 17 00:00:00 2001 From: Tom Brunet Date: Tue, 26 Mar 2024 14:37:32 -0500 Subject: [PATCH 2/4] Update accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx --- .../src/ts/devtools/components/scanSection.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx b/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx index da1377b6a..e48402f52 100644 --- a/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx +++ b/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx @@ -294,7 +294,6 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { } if (reportIssues) { filterCounts = this.getCounts(reportIssues); - console.log("scan section filterCounts = ",filterCounts); reportIssues = reportIssues.filter((issue: IIssue) => { let retVal = (this.state.checked[UtilIssue.valueToStringSingular(issue.value) as eLevel] && (!this.state.focusMode From 44c535153a2f535916da3f599c7e26ee7fabc8d5 Mon Sep 17 00:00:00 2001 From: Josiah Hoskins Date: Tue, 26 Mar 2024 19:49:33 -0500 Subject: [PATCH 3/4] hidden count fix to report --- .../src/ts/devtools/devtoolsController.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/accessibility-checker-extension/src/ts/devtools/devtoolsController.ts b/accessibility-checker-extension/src/ts/devtools/devtoolsController.ts index 2e05b19dd..69bc5b31c 100644 --- a/accessibility-checker-extension/src/ts/devtools/devtoolsController.ts +++ b/accessibility-checker-extension/src/ts/devtools/devtoolsController.ts @@ -14,8 +14,8 @@ limitations under the License. *****************************************************************************/ -import { getBGController, TabChangeType } from "../background/backgroundController"; -import { IBasicTableRowRecord, IIssue, IMessage, IReport, IStoredReportMeta } from "../interfaces/interfaces"; +import { getBGController, issueBaselineMatch, TabChangeType } from "../background/backgroundController"; +import { IBasicTableRowRecord, IIssue, IMessage, IReport, IStoredReportMeta, UIIssue } from "../interfaces/interfaces"; import { CommonMessaging } from "../messaging/commonMessaging"; import { Controller, eControllerType, ListenerType } from "../messaging/controller"; import Config from "../util/config"; @@ -212,18 +212,20 @@ export class DevtoolsController extends Controller { } } - async getCountsWithHidden (reportCounts: IReport["counts"], ignored: IIssue[]) { + async getCountsWithHidden (reportCounts: IReport["counts"], issues:UIIssue[], ignored: IIssue[]) { let counts = this.initCount(); // setup counts // populate initial counts counts.Violation = reportCounts.Violation; counts["Needs review"] = reportCounts["Needs review"]; counts.Recommendation = reportCounts.Recommendation; - counts.Hidden = ignored.length; + counts.Hidden = 0; counts.Pass = reportCounts.Pass; // correct issue type counts to take into account the hidden issues if (ignored.length > 0) { // if we have hidden for (const ignoredIssue of ignored) { + if (!issues.some(issue => issueBaselineMatch(issue, ignoredIssue))) continue; + counts.Hidden++; if ("Violation" === this.valueMap[ignoredIssue.value[0]][ignoredIssue.value[1]]) { counts.Violation--; } @@ -250,7 +252,7 @@ export class DevtoolsController extends Controller { let tabId = getTabId(); let tabInfo = await bgController.getTabInfo(tabId); let ignored: IIssue[] = await bgController.getIgnore(tabInfo.url!); - let newCounts = await this.getCountsWithHidden(report.counts, ignored); + let newCounts = await this.getCountsWithHidden(report.counts, report.results, ignored); const now = new Date().getTime(); devtoolsState!.lastReportMeta = { id: devtoolsState!.storedReports.length+"", From 44199554b74561767744150ab304e1cb88a8c90b Mon Sep 17 00:00:00 2001 From: Josiah Hoskins Date: Tue, 26 Mar 2024 22:19:55 -0500 Subject: [PATCH 4/4] a bit more counting --- .../src/ts/devtools/components/scanSection.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx b/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx index e48402f52..dd19a3d33 100644 --- a/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx +++ b/accessibility-checker-extension/src/ts/devtools/components/scanSection.tsx @@ -284,12 +284,12 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { render() { let reportIssues : IIssue[] | null = null; let filterCounts: CountType = this.initCount(); - let quickTotalCount = 0; + // let quickTotalCount = 0; let totalCount = 0; if (this.state.report) { - quickTotalCount = this.state.report.counts.Violation + - this.state.report.counts['Needs review'] + - this.state.report.counts.Recommendation - this.state.ignoredIssues.length; + // quickTotalCount = this.state.report.counts.Violation + + // this.state.report.counts['Needs review'] + + // this.state.report.counts.Recommendation - this.state.ignoredIssues.length; reportIssues = this.state.report ? JSON.parse(JSON.stringify(this.state.report.results)) : null; } if (reportIssues) { @@ -309,7 +309,6 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { totalCount += filterCounts[levelStr as eLevel].total; {UtilIssueReact.valueSingToIcon(levelStr, "reportSecIcon")} })} - let selectedElementStr = this.state.selectedElemPath; if (selectedElementStr) { @@ -457,7 +456,7 @@ export class ScanSection extends React.Component<{}, ScanSectionState> {
{["Violation", "Needs review", "Recommendation"].map((levelStr) => { - totalCount += filterCounts[levelStr as eLevel].total; + // totalCount += filterCounts[levelStr as eLevel].total; return <> @@ -504,7 +503,7 @@ export class ScanSection extends React.Component<{}, ScanSectionState> { let appController = getDevtoolsAppController(); getDevtoolsAppController().setSecondaryView("summary"); appController.openSecondary("totalIssuesCount"); - }}>{quickTotalCount} issues found + }}>{totalCount} issues found