Skip to content

Commit 19be2da

Browse files
committed
SelectBox: Fix select title. Fixes: microsoft#73844
1 parent 6526507 commit 19be2da

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/vs/base/browser/ui/selectBox/selectBoxCustom.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
191191
index: e.target.selectedIndex,
192192
selected: e.target.value
193193
});
194+
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
195+
this.selectElement.title = this.options[this.selected].text;
196+
}
194197
}));
195198

196199
// Have to implement both keyboard and mouse controllers to handle disabled options
@@ -282,6 +285,9 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
282285
}
283286

284287
this.selectElement.selectedIndex = this.selected;
288+
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
289+
this.selectElement.title = this.options[this.selected].text;
290+
}
285291
}
286292

287293
public setAriaLabel(label: string): void {
@@ -395,7 +401,7 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
395401
let listBackground = this.styles.selectListBackground ? this.styles.selectListBackground.toString() : background;
396402
this.selectDropDownListContainer.style.backgroundColor = listBackground;
397403
this.selectionDetailsPane.style.backgroundColor = listBackground;
398-
const optionsBorder = this.styles.focusBorder ? this.styles.focusBorder.toString() : null;
404+
const optionsBorder = this.styles.focusBorder ? this.styles.focusBorder.toString() : '';
399405
this.selectDropDownContainer.style.outlineColor = optionsBorder;
400406
this.selectDropDownContainer.style.outlineOffset = '-1px';
401407
}
@@ -798,7 +804,11 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
798804
this._onDidSelect.fire({
799805
index: this.selectElement.selectedIndex,
800806
selected: this.options[this.selected].text
807+
801808
});
809+
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
810+
this.selectElement.title = this.options[this.selected].text;
811+
}
802812
}
803813

804814
this.hideSelectDropDown(true);
@@ -891,6 +901,9 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
891901
index: this.selectElement.selectedIndex,
892902
selected: this.options[this.selected].text
893903
});
904+
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
905+
this.selectElement.title = this.options[this.selected].text;
906+
}
894907
}
895908

896909
this.hideSelectDropDown(true);

0 commit comments

Comments
 (0)