Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(node): ESM packages need .js extension for modules for v4.x #2182

Merged
merged 16 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h3 id="ruleMessage"></h3>

Visible labels are essential, so every user can know what information to enter:
- People with cognitive, language, and learning disabilities, older adults, and all users will easily learn what information is expected.
- People using voice control will see what to speak. This allows them to easily jump to interactive elements and form fields.
- People using voice control will see what to speak. This allows them to easily jump to interactive elements, buttons, and form fields.

Placeholder labels when used as the only visible label can reduce the accessibility for a wide range of users. Avoid placeholder labels for the following reasons:
- May not be persistent: the placeholder label disappears when the user starts typing in the input field
Expand All @@ -60,7 +60,7 @@ <h3 id="ruleMessage"></h3>

### What to do

The intent of labels, including expected formats and required fields,
The intent of labels, including expected formats, required fields and button text
on interactive elements is not to clutter the page with unnecessary information but to provide important cues that will benefit all users.
Too much information can be just as harmful as too little.

Expand Down Expand Up @@ -98,6 +98,7 @@ <h3 id="ruleMessage"></h3>
### About this requirement

* [IBM 3.3.2 Label or Instruction](https://www.ibm.com/able/requirements/requirements/#3_3_2)
* [IBM 2.5.3 Label in Name](https://www.ibm.com/able/requirements/requirements/#2_5_3)
* [H44: Associate text labels with form controls](https://www.w3.org/WAI/WCAG22/Techniques/html/H44)
* [ARIA1: Use aria-describedby to label a user interface control](https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA1)
* [ARIA9: Use aria-labelledby to concatenate several text nodes](https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA9)
Expand Down
20 changes: 9 additions & 11 deletions accessibility-checker/src-ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
limitations under the License.
*****************************************************************************/

import { ACBrowserManager } from "./lib/ACBrowserManager";
import { ACEngineManager } from "./lib/ACEngineManager";
import { getComplianceHelper } from "./lib/ACHelper";
import { eAssertResult, ICheckerReport, ICheckerResult, ReportResult } from "./lib/api/IChecker";
import { ACConfigManager } from "./lib/common/config/ACConfigManager";
import { IConfig, IConfigInternal } from "./lib/common/config/IConfig";
import { Checkpoint } from "./lib/common/engine/IGuideline";
import { IBaselineReport } from "./lib/common/engine/IReport";
import { Issue } from "./lib/common/engine/IRule";
import { BaselineManager } from "./lib/common/report/BaselineManager";
import { ReporterManager } from "./lib/common/report/ReporterManager";
import { ACBrowserManager } from "./lib/ACBrowserManager.js";
import { ACEngineManager } from "./lib/ACEngineManager.js";
import { getComplianceHelper } from "./lib/ACHelper.js";
import { eAssertResult, ICheckerReport, ICheckerResult, ReportResult } from "./lib/api/IChecker.js";
import { ACConfigManager } from "./lib/common/config/ACConfigManager.js";
import { IConfig, IConfigInternal } from "./lib/common/config/IConfig.js";
import { IBaselineReport } from "./lib/common/engine/IReport.js";
import { BaselineManager } from "./lib/common/report/BaselineManager.js";
import { ReporterManager } from "./lib/common/report/ReporterManager.js";

/**
* This function is responsible performing a scan based on the context that is provided, following are
Expand Down
20 changes: 12 additions & 8 deletions accessibility-checker/src-ts/lib/ACEngineManager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as path from "path";
import * as fs from "fs";
import { ACConfigManager } from "./common/config/ACConfigManager";
import { fetch_get_text } from "./common/api-ext/Fetch";
import { IChecker } from "./common/engine/IChecker";
import { ACConfigManager } from "./common/config/ACConfigManager.js";
import { fetch_get_text } from "./common/api-ext/Fetch.js";
import { IChecker } from "./common/engine/IChecker.js";

// The following two lines will be modified by sed for cjs vs mjs environments. Look at package.json before modifying
// import { createRequire } from "module";
Expand Down Expand Up @@ -30,6 +30,7 @@ export class ACEngineManager {
config.DEBUG && console.log("[INFO] aChecker.loadEngine detected Puppeteer/Playwright");
let page = content;
if (ENGINE_LOAD_MODE === "REMOTE") {
config.DEBUG && console.log("[INFO] engineMode REMOTE");
await page.evaluate((scriptUrl) => {
try {
var ace_backup_in_ibma;
Expand Down Expand Up @@ -65,19 +66,21 @@ export class ACEngineManager {
}
}, `${config.rulePack}/ace.js`);
} else if (ENGINE_LOAD_MODE === "INJECT") {
await page.evaluate((engineContent) => {
config.DEBUG && console.log("[INFO] engineMode INJECT");
let aceAlreadyExists = await page.evaluate(() => { try { return 'undefined' !== typeof(ace) } catch (e) { return false; } });
await page.evaluate(({ engineContent, aceAlreadyExists }) => {
try {
var ace_backup_in_ibma;
if ('undefined' !== typeof(ace)) {
if (aceAlreadyExists) {
if (!ace || !ace.Checker)
ace_backup_in_ibma = ace;
ace = null;
}
if ('undefined' === typeof (ace) || ace === null) {
if (!aceAlreadyExists || ace === null) {
return new Promise<void>((resolve, reject) => {
eval(engineContent);
globalThis.ace_ibma = ace;
if ('undefined' !== typeof ace) {
if (aceAlreadyExists) {
ace = ace_backup_in_ibma;
}
resolve();
Expand All @@ -86,7 +89,8 @@ export class ACEngineManager {
} catch (e) {
return Promise.reject(e);
}
}, ACEngineManager.engineContent);
}, {
engineContent: ACEngineManager.engineContent, aceAlreadyExists });
}
return ACEngineManager.loadEngineLocal();
} else if (ACEngineManager.isSelenium(content)) {
Expand Down
2 changes: 1 addition & 1 deletion accessibility-checker/src-ts/lib/ACHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ACConfigManager } from "./common/config/ACConfigManager.js";
import { IConfigInternal } from "./common/config/IConfig.js";
import { ReporterManager } from "./common/report/ReporterManager.js";
import { IAbstractAPI } from "./common/api-ext/IAbstractAPI.js";
import { EngineSummaryCounts, IBaselineReport, IEngineReport } from "./common/engine/IReport";
import { EngineSummaryCounts, IBaselineReport, IEngineReport } from "./common/engine/IReport.js";
import { BaselineManager, RefactorMap } from "./common/report/BaselineManager.js";

declare var after;
Expand Down
8 changes: 4 additions & 4 deletions common/module/src/report/ACReporterCSV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
limitations under the License.
*****************************************************************************/

import { IConfigInternal } from "../config/IConfig";
import { Guideline } from "../engine/IGuideline";
import { CompressedReport } from "../engine/IReport";
import { GenSummReturn, IReporter, ReporterManager } from "./ReporterManager";
import { IConfigInternal } from "../config/IConfig.js";
import { Guideline } from "../engine/IGuideline.js";
import { CompressedReport } from "../engine/IReport.js";
import { GenSummReturn, IReporter, ReporterManager } from "./ReporterManager.js";

export class ACReporterCSV implements IReporter {
public name(): string {
Expand Down
10 changes: 5 additions & 5 deletions common/module/src/report/ACReporterHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
*****************************************************************************/

import { IConfigInternal } from "../config/IConfig";
import { Guideline } from "../engine/IGuideline";
import { CompressedReport, IBaselineReport } from "../engine/IReport";
import { GenSummReturn, IReporter, IReporterStored, ReporterManager } from "./ReporterManager";
import { genReport } from "./genReport";
import { IConfigInternal } from "../config/IConfig.js";
import { Guideline } from "../engine/IGuideline.js";
import { CompressedReport, IBaselineReport } from "../engine/IReport.js";
import { GenSummReturn, IReporter, IReporterStored, ReporterManager } from "./ReporterManager.js";
import { genReport } from "./genReport.js";

export class ACReporterHTML implements IReporter {
public name(): string {
Expand Down
8 changes: 4 additions & 4 deletions common/module/src/report/ACReporterJSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
limitations under the License.
*****************************************************************************/

import { IConfigInternal } from "../config/IConfig";
import { Guideline } from "../engine/IGuideline";
import { CompressedReport, IBaselineReport, IEngineReport } from "../engine/IReport";
import { GenSummReturn, IReporter, IReporterStored, ReporterManager } from "./ReporterManager";
import { IConfigInternal } from "../config/IConfig.js";
import { Guideline } from "../engine/IGuideline.js";
import { CompressedReport, IBaselineReport, IEngineReport } from "../engine/IReport.js";
import { GenSummReturn, IReporter, IReporterStored, ReporterManager } from "./ReporterManager.js";

export class ACReporterJSON implements IReporter {
public name(): string {
Expand Down
10 changes: 5 additions & 5 deletions common/module/src/report/ACReporterMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
*****************************************************************************/

import { fetch_get } from "../api-ext/Fetch";
import { IConfigInternal } from "../config/IConfig";
import { Guideline } from "../engine/IGuideline";
import { CompressedReport } from "../engine/IReport";
import { GenSummReturn, IReporter, IReporterStored } from "./ReporterManager";
import { fetch_get } from "../api-ext/Fetch.js";
import { IConfigInternal } from "../config/IConfig.js";
import { Guideline } from "../engine/IGuideline.js";
import { CompressedReport } from "../engine/IReport.js";
import { GenSummReturn, IReporter, IReporterStored } from "./ReporterManager.js";

/*******************************************************************************
* NAME: ACMetricsLogger.js
Expand Down
10 changes: 5 additions & 5 deletions common/module/src/report/ACReporterXLSX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
*****************************************************************************/

import { IConfigInternal, eRuleLevel } from "../config/IConfig";
import { Checkpoint, Guideline, eToolkitLevel } from "../engine/IGuideline";
import { CompressedReport } from "../engine/IReport";
import { eRuleConfidence } from "../engine/IRule";
import { GenSummReturn, IReporter, ReporterManager } from "./ReporterManager";
import { IConfigInternal, eRuleLevel } from "../config/IConfig.js";
import { Checkpoint, Guideline, eToolkitLevel } from "../engine/IGuideline.js";
import { CompressedReport } from "../engine/IReport.js";
import { eRuleConfidence } from "../engine/IRule.js";
import { GenSummReturn, IReporter, ReporterManager } from "./ReporterManager.js";
import * as ExcelJS from "exceljs";

type PolicyInfo = {
Expand Down
20 changes: 10 additions & 10 deletions common/module/src/report/ReporterManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
limitations under the License.
*****************************************************************************/

import { IAbstractAPI } from "../api-ext/IAbstractAPI";
import { IConfigInternal, eRuleLevel } from "../config/IConfig";
import { CompressedIssue, CompressedReport, IBaselineReport, IBaselineResult, IEngineReport } from "../engine/IReport";
import { ACReporterMetrics } from "./ACReporterMetrics";
import { ACReporterCSV } from "./ACReporterCSV";
import { ACReporterHTML } from "./ACReporterHTML";
import { ACReporterJSON } from "./ACReporterJSON";
import { ACReporterXLSX } from "./ACReporterXLSX";
import { Guideline } from "../engine/IGuideline";
import { eRuleConfidence, eRulePolicy } from "../engine/IRule";
import { IAbstractAPI } from "../api-ext/IAbstractAPI.js";
import { IConfigInternal, eRuleLevel } from "../config/IConfig.js";
import { CompressedIssue, CompressedReport, IBaselineReport, IBaselineResult, IEngineReport } from "../engine/IReport.js";
import { ACReporterCSV } from "./ACReporterCSV.js";
import { ACReporterHTML } from "./ACReporterHTML.js";
import { ACReporterJSON } from "./ACReporterJSON.js";
import { ACReporterXLSX } from "./ACReporterXLSX.js";
import { Guideline } from "../engine/IGuideline.js";
import { eRuleConfidence, eRulePolicy } from "../engine/IRule.js";
import { ACReporterMetrics } from "./ACReporterMetrics.js";

export interface IReporterStored {
startScan: number,
Expand Down