Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #82200 - "Preserve Case" button in search viewlet is not tabbable #82485

Merged
merged 3 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/search/browser/searchView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class SearchView extends ViewletPanel {
if (this.searchWidget.isReplaceActive()) {
this.searchWidget.focusReplaceAllAction();
} else {
this.searchWidget.focusRegexAction();
this.searchWidget.isReplaceShown() ? this.searchWidget.replaceInput.focusOnPreserve() : this.searchWidget.focusRegexAction();
}
dom.EventHelper.stop(e);
}
Expand Down
14 changes: 14 additions & 0 deletions src/vs/workbench/contrib/search/browser/searchWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export class SearchWidget extends Widget {
this.replaceInputFocusTracker = this._register(dom.trackFocus(this.replaceInput.inputBox.inputElement));
this._register(this.replaceInputFocusTracker.onDidFocus(() => this.replaceInputBoxFocused.set(true)));
this._register(this.replaceInputFocusTracker.onDidBlur(() => this.replaceInputBoxFocused.set(false)));
this._register(this.replaceInput.onPreserveCaseKeyDown((keyboardEvent: IKeyboardEvent) => this.onPreserveCaseKeyDown(keyboardEvent)));
}

triggerReplaceAll(): Promise<any> {
Expand Down Expand Up @@ -495,6 +496,15 @@ export class SearchWidget extends Widget {
}

private onRegexKeyDown(keyboardEvent: IKeyboardEvent) {
if (keyboardEvent.equals(KeyCode.Tab)) {
if (this.isReplaceShown()) {
this.replaceInput.focusOnPreserve();
keyboardEvent.preventDefault();
}
}
}

private onPreserveCaseKeyDown(keyboardEvent: IKeyboardEvent) {
if (keyboardEvent.equals(KeyCode.Tab)) {
if (this.isReplaceActive()) {
this.focusReplaceAllAction();
Expand All @@ -503,6 +513,10 @@ export class SearchWidget extends Widget {
}
keyboardEvent.preventDefault();
}
else if (KeyMod.Shift | KeyCode.Tab) {
this.focusRegexAction();
keyboardEvent.preventDefault();
}
}

private onReplaceInputKeyDown(keyboardEvent: IKeyboardEvent) {
Expand Down