Skip to content

Commit a473ea2

Browse files
Fix for capture screenshot in accessibility
1 parent 6f5fafc commit a473ea2

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

accessibility/scanner/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,19 +194,16 @@ const processAccessibilityReport = async (windowNew) => {
194194
if (captureScreenshot) {
195195
if (scanData && scanData.data && scanData.data.length > 0 && globalScreenshots) {
196196
const firstDataItem = scanData.data[0];
197+
198+
// Extension always provides screenshotId and screenBound in each issue
199+
// Get screenshotId from the first issue to use the extension's ID
197200
if (firstDataItem.events && firstDataItem.events.length > 0) {
198201
const firstEvent = firstDataItem.events[0];
199-
if (firstEvent.issues && firstEvent.issues.length > 0) {
200-
// Update screenshotId with the actual screenshotId
201-
globalScreenshots[0].screenshotId=firstEvent.issues[0].screenshotId;
202-
}
203-
}
204-
for (let i = 0; i < scanData.data.length; i++) {
205-
if (scanData.data[i].screenshots && Array.isArray(scanData.data[i].screenshots)) {
206-
scanData.data[i].screenshots = globalScreenshots;
207-
break;
202+
if (firstEvent.issues && firstEvent.issues.length > 0 && firstEvent.issues[0].screenshotId) {
203+
globalScreenshots[0].screenshotId = firstEvent.issues[0].screenshotId;
208204
}
209205
}
206+
scanData.data[0].screenshots = globalScreenshots;
210207
}
211208
globalScreenshots = null;
212209
}

0 commit comments

Comments
 (0)