Skip to content

Commit

Permalink
Trim whitespace from accessible name before returning.
Browse files Browse the repository at this point in the history
This matches the behaviour implemented by browsers. Filed w3c/accname#95

PiperOrigin-RevId: 344223264
  • Loading branch information
AlexLloyd0 authored and Copybara-Service committed Nov 25, 2020
1 parent 14d31f9 commit ab9772d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/compute_text_alternative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export function computeTextAlternative(
// A rule has been applied if its implementation has
// returned a string.
if (result !== null) {
context.inherited.rulesApplied.add(<Rule>rule);
context.inherited.rulesApplied.add(rule as Rule);
return {
name: result,
name: result.trim(),
nodesUsed: context.inherited.nodesUsed,
rulesApplied: context.inherited.rulesApplied,
};
Expand All @@ -83,4 +83,4 @@ export function computeTextAlternative(
nodesUsed: context.inherited.nodesUsed,
rulesApplied: context.inherited.rulesApplied,
};
}
}

0 comments on commit ab9772d

Please sign in to comment.