Skip to content

Commit

Permalink
Fix #142421
Browse files Browse the repository at this point in the history
POINTER_DOWN was stealing too many events.
The old event handlers handled events such as MOUSE_UP,
and it turns out we can just use POINTER_UP instead.
  • Loading branch information
rzhao271 committed Feb 7, 2022
1 parent 09d3d16 commit 10da7d1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/vs/base/browser/ui/selectBox/selectBoxCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
this._register(onSelectDropDownKeyDown.filter(e => (e.keyCode >= KeyCode.Digit0 && e.keyCode <= KeyCode.KeyZ) || (e.keyCode >= KeyCode.Semicolon && e.keyCode <= KeyCode.NumpadDivide)).on(this.onCharacter, this));

// SetUp list mouse controller - control navigation, disabled items, focus

this._register(dom.addDisposableListener(this.selectList.getHTMLElement(), dom.EventType.POINTER_DOWN, e => this.onPointerDown(e)));
this._register(dom.addDisposableListener(this.selectList.getHTMLElement(), dom.EventType.POINTER_UP, e => this.onPointerUp(e)));

this._register(this.selectList.onMouseOver(e => typeof e.index !== 'undefined' && this.selectList.setFocus([e.index])));
this._register(this.selectList.onDidChangeFocus(e => this.onListFocus(e)));
Expand All @@ -800,7 +799,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi

// List mouse controller - active exit, select option, fire onDidSelect if change, return focus to parent select
// Also takes in touchend events
private onPointerDown(e: PointerEvent): void {
private onPointerUp(e: PointerEvent): void {

if (!this.selectList.length) {
return;
Expand All @@ -814,7 +813,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
}

// Check our mouse event is on an option (not scrollbar)
if (!!target.classList.contains('slider')) {
if (target.classList.contains('slider')) {
return;
}

Expand Down

0 comments on commit 10da7d1

Please sign in to comment.