Skip to content

Commit 486628e

Browse files
committed
feat(unity-bootstrap-theme): setup aria-label for p
UDS-2010
1 parent 173e8ba commit 486628e

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

packages/unity-bootstrap-theme/src/js/card-bodies.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,8 @@ function initCardBodies() {
4242
}
4343
visibleText = tempText + '...';
4444

45-
// Create a new hidden element to store the truncated text
46-
const visibleTextElementId = `visible-text-${Math.random().toString(36).substring(7)}`;
47-
const visibleTextElement = document.createElement('div');
48-
visibleTextElement.id = visibleTextElementId;
49-
visibleTextElement.textContent = visibleText;
50-
visibleTextElement.style.position = 'absolute';
51-
visibleTextElement.style.top = '0';
52-
visibleTextElement.style.zIndex = '-1';
45+
paragraph.setAttribute('aria-label', visibleText);
5346

54-
// Add the hidden element to the DOM
55-
cardBody.appendChild(visibleTextElement);
56-
57-
paragraph.setAttribute('aria-describedby', visibleTextElementId);
58-
59-
// Hide the original paragraph from screen readers
60-
paragraph.setAttribute('aria-hidden', 'true');
6147
}
6248
});
6349

0 commit comments

Comments
 (0)