diff --git a/tests/e2e/issue-comment.test.e2e.ts b/tests/e2e/issue-comment.test.e2e.ts index 94e4bb7243..ed1c79a585 100644 --- a/tests/e2e/issue-comment.test.e2e.ts +++ b/tests/e2e/issue-comment.test.e2e.ts @@ -331,7 +331,7 @@ test('Emoji suggestions', async ({page}) => { ]; for (const {emoji, name} of expectedSuggestions) { - const item = suggestionList.locator(`li:has-text("${name}")`); + const item = suggestionList.locator(`[id="combobox-emoji-${name}"]`); await expect(item).toContainText(`${emoji} ${name}`); } diff --git a/web_src/js/features/comp/TextExpander.js b/web_src/js/features/comp/TextExpander.js index 8777f3a334..ae652a013b 100644 --- a/web_src/js/features/comp/TextExpander.js +++ b/web_src/js/features/comp/TextExpander.js @@ -12,6 +12,7 @@ export function initTextExpander(expander) { ul.classList.add('suggestions'); for (const name of matches) { const li = document.createElement('li'); + li.setAttribute('id', `combobox-emoji-${name}`); li.setAttribute('role', 'option'); li.setAttribute('data-value', emojiString(name)); if (customEmojis.has(name)) { @@ -33,10 +34,12 @@ export function initTextExpander(expander) { ul.classList.add('suggestions'); for (const {value, name, fullname, avatar} of matches) { const li = document.createElement('li'); + li.setAttribute('id', `combobox-user-${name}`); li.setAttribute('role', 'option'); li.setAttribute('data-value', `${key}${value}`); const img = document.createElement('img'); + img.setAttribute('aria-hidden', 'true'); img.src = avatar; li.append(img);