Skip to content

Commit

Permalink
fix(codegen): trim alt selectors to 80 chars (#31346)
Browse files Browse the repository at this point in the history
Fixes #31254
  • Loading branch information
yury-s committed Jun 17, 2024
1 parent f3f708e commit 5443b66
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ function suitableTextAlternatives(text: string) {
const match = text.match(/^([\d.,]+)[^.,\w]/);
const leadingNumberLength = match ? match[1].length : 0;
if (leadingNumberLength) {
const alt = text.substring(leadingNumberLength).trimStart();
const alt = trimWordBoundary(text.substring(leadingNumberLength).trimStart(), 80);
result.push({ text: alt, scoreBouns: alt.length <= 30 ? 2 : 1 });
}
}
Expand All @@ -537,7 +537,7 @@ function suitableTextAlternatives(text: string) {
const match = text.match(/[^.,\w]([\d.,]+)$/);
const trailingNumberLength = match ? match[1].length : 0;
if (trailingNumberLength) {
const alt = text.substring(0, text.length - trailingNumberLength).trimEnd();
const alt = trimWordBoundary(text.substring(0, text.length - trailingNumberLength).trimEnd(), 80);
result.push({ text: alt, scoreBouns: alt.length <= 30 ? 2 : 1 });
}
}
Expand Down

0 comments on commit 5443b66

Please sign in to comment.