diff --git a/tests/e2e/explore.test.ts b/tests/e2e/explore.test.ts index 49cd9bb87af..dcec4581634 100644 --- a/tests/e2e/explore.test.ts +++ b/tests/e2e/explore.test.ts @@ -4,14 +4,18 @@ test('explore repositories', async ({page}) => { await page.goto('/explore/repos'); await expect(page.getByPlaceholder('Search repos…')).toBeVisible(); await expect(page.getByRole('link', {name: 'Repositories'})).toBeVisible(); + await expect(page.getByLabel('Filter', {exact: true})).toBeVisible(); + await expect(page.getByLabel('Sort', {exact: true})).toBeVisible(); }); test('explore users', async ({page}) => { await page.goto('/explore/users'); await expect(page.getByPlaceholder('Search users…')).toBeVisible(); + await expect(page.getByLabel('Sort', {exact: true})).toBeVisible(); }); test('explore organizations', async ({page}) => { await page.goto('/explore/organizations'); await expect(page.getByPlaceholder('Search orgs…')).toBeVisible(); + await expect(page.getByLabel('Sort', {exact: true})).toBeVisible(); }); diff --git a/web_src/js/modules/fomantic/dropdown.ts b/web_src/js/modules/fomantic/dropdown.ts index 8705d9073a0..d1f064ba6b0 100644 --- a/web_src/js/modules/fomantic/dropdown.ts +++ b/web_src/js/modules/fomantic/dropdown.ts @@ -167,6 +167,14 @@ function attachStaticElements(dropdown: AriaDropdownElement, focusable: HTMLElem if (tooltipContent && !dropdown.getAttribute('aria-label')) { dropdown.setAttribute('aria-label', tooltipContent); } + // a selection dropdown's text is its value, other dropdowns are button-like and named by their visible text + if (!dropdown.classList.contains('selection') && !focusable.getAttribute('aria-label') && !focusable.getAttribute('aria-labelledby')) { + const textElem = dropdown.querySelector(':scope > .text, :scope > span'); + if (textElem) { + if (!textElem.id) textElem.id = generateElemId('_aria_dropdown_text_'); + focusable.setAttribute('aria-labelledby', textElem.id); + } + } } function attachInitElements(dropdown: AriaDropdownElement) {