mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix a11y issue (#9733)
This commit is contained in:
@@ -37,6 +37,15 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$show(instance: number, options: IPickOptions<TransferQuickPickItems>, token: CancellationToken): Promise<number | number[] | undefined> {
|
$show(instance: number, options: IPickOptions<TransferQuickPickItems>, token: CancellationToken): Promise<number | number[] | undefined> {
|
||||||
|
// {{ SQL CARBON EDIT }} Fix a11y issue https://github.com/microsoft/azuredatastudio/issues/9232
|
||||||
|
const activeElement = document.activeElement as HTMLElement;
|
||||||
|
const focusBackToStartingPosition = () => {
|
||||||
|
try {
|
||||||
|
activeElement?.focus();
|
||||||
|
} catch { }
|
||||||
|
};
|
||||||
|
// {{ SQL CARBON EDIT }} Fix a11y issue https://github.com/microsoft/azuredatastudio/issues/9232
|
||||||
|
|
||||||
const contents = new Promise<TransferQuickPickItems[]>((resolve, reject) => {
|
const contents = new Promise<TransferQuickPickItems[]>((resolve, reject) => {
|
||||||
this._items[instance] = { resolve, reject };
|
this._items[instance] = { resolve, reject };
|
||||||
});
|
});
|
||||||
@@ -52,6 +61,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
|
|||||||
|
|
||||||
if (options.canPickMany) {
|
if (options.canPickMany) {
|
||||||
return this._quickInputService.pick(contents, options as { canPickMany: true }, token).then(items => {
|
return this._quickInputService.pick(contents, options as { canPickMany: true }, token).then(items => {
|
||||||
|
focusBackToStartingPosition(); // {{ SQL CARBON EDIT }} Fix a11y issue https://github.com/microsoft/azuredatastudio/issues/9232
|
||||||
if (items) {
|
if (items) {
|
||||||
return items.map(item => item.handle);
|
return items.map(item => item.handle);
|
||||||
}
|
}
|
||||||
@@ -59,6 +69,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return this._quickInputService.pick(contents, options, token).then(item => {
|
return this._quickInputService.pick(contents, options, token).then(item => {
|
||||||
|
focusBackToStartingPosition(); // {{ SQL CARBON EDIT }} Fix a11y issue https://github.com/microsoft/azuredatastudio/issues/9232
|
||||||
if (item) {
|
if (item) {
|
||||||
return item.handle;
|
return item.handle;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user