Resolves an intermittent issue where the text input in the "Ask" window would not auto-focus on Windows (#41)
This commit is contained in:
parent
4dcf19f6a5
commit
d2951f9fef
@ -857,12 +857,7 @@ export class AskView extends LitElement {
|
|||||||
ipcRenderer.on('window-blur', this.handleWindowBlur);
|
ipcRenderer.on('window-blur', this.handleWindowBlur);
|
||||||
ipcRenderer.on('window-did-show', () => {
|
ipcRenderer.on('window-did-show', () => {
|
||||||
if (!this.currentResponse && !this.isLoading && !this.isStreaming) {
|
if (!this.currentResponse && !this.isLoading && !this.isStreaming) {
|
||||||
setTimeout(() => {
|
this.focusTextInput();
|
||||||
const textInput = this.shadowRoot?.getElementById('textInput');
|
|
||||||
if (textInput) {
|
|
||||||
textInput.focus();
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1291,6 +1286,19 @@ export class AskView extends LitElement {
|
|||||||
if (changedProperties.has('showTextInput') || changedProperties.has('isLoading')) {
|
if (changedProperties.has('showTextInput') || changedProperties.has('isLoading')) {
|
||||||
this.adjustWindowHeightThrottled();
|
this.adjustWindowHeightThrottled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changedProperties.has('showTeextInput') && this.showTextInput) {
|
||||||
|
this.focusTextInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
focusTextInput(){
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
const textInput = this.shadowRoot?.getElementById('textInput');
|
||||||
|
if (textInput){
|
||||||
|
textInput.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user