Add presentation role to text layer spans. (#13278)

Keeps screen readers from pausing on every span so
paragraphs are read more naturally. Note: this only seems
to affect Firefox, Chrome automatically combines the spans.
This commit is contained in:
Brendan Dahl 2021-04-21 01:47:51 -07:00 committed by GitHub
parent b0d58efb6a
commit 5231d922ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,6 +173,9 @@ const renderTextLayer = (function renderTextLayerClosure() {
textDiv.style.fontSize = `${fontHeight}px`;
textDiv.style.fontFamily = style.fontFamily;
// Keeps screen readers from pausing on every new text span.
textDiv.setAttribute("role", "presentation");
textDiv.textContent = geom.str;
// geom.dir may be 'ttb' for vertical texts.
textDiv.dir = geom.dir;