diff --git a/server/src/accessibilityPatterns.ts b/server/src/accessibilityPatterns.ts index 689972d..84d394e 100644 --- a/server/src/accessibilityPatterns.ts +++ b/server/src/accessibilityPatterns.ts @@ -11,18 +11,18 @@ // Order based om most common types first const patterns: string[] = [ - '|)(?:.)+?>', - '|)(?:.)+?>', + ']*)?>', + ']*)?>', // "id=\"(?:.)+?\"", - '(?:(?:\\s|\\S)+?(?=))', - '', - '', - '(?:(?:\\s|\\S|)+?(?=))', - '|)(?:.)+?>', - 'tabindex="(?:.)+?"', - '<(?:i|)frame (?:.|)+?>', + ']*)?>(.*)(?=)', + ']*)?>', + ']*)?>', + ']*)?>(.*)(?=)', + ']*)?>', + 'tabindex=".*"', + ']*)?>', ]; -export const pattern: RegExp = new RegExp(patterns.join('|'), 'ig'); +export const pattern: RegExp = new RegExp(patterns.join('|'), 'igs'); const nonDescriptiveAlts: string[] = [ 'alt="image"', @@ -63,9 +63,9 @@ export async function validateDiv(m: RegExpExecArray) { } export async function validateSpan(m: RegExpExecArray) { - if (!/role=(?:.*?[a-z].*?)"/i.test(m[0])) { - if (!//.test(m[0])) { - if (//.test(m[0])) { + if (!/role=(?:.*[a-z].*)"/im.test(m[0])) { + if (!//si.test(m[0])) { + if (//si.test(m[0])) { return { meta: m, mess: 'Change the span to a