From 9003ae2d5355cefc6348fac8efd391b00a46024d Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 30 Sep 2020 10:40:24 -0700 Subject: [PATCH] Custom selectbox should add decorator label and description to aria label, and should not use aria-describedby Fix #107662 --- .../browser/ui/selectBox/selectBoxCustom.ts | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts index b9b99af5342..c2395b8d6f7 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts @@ -29,7 +29,6 @@ const SELECT_OPTION_ENTRY_TEMPLATE_ID = 'selectOption.entry.template'; interface ISelectListTemplateData { root: HTMLElement; text: HTMLElement; - itemDescription: HTMLElement; decoratorRight: HTMLElement; disposables: IDisposable[]; } @@ -44,8 +43,6 @@ class SelectListRenderer implements IListRenderer element.text, + getAriaLabel: element => { + let label = element.text; + if (element.decoratorRight) { + label += `. ${element.decoratorRight}`; + } + + if (element.description) { + label += `. ${element.description}`; + } + + return label; + }, getWidgetAriaLabel: () => localize({ key: 'selectBox', comment: ['Behave like native select dropdown element.'] }, "Select Box"), getRole: () => 'option', getWidgetRole: () => 'listbox'