Skip to content

Commit

Permalink
[Observability AI Assistant] Input box can be resized off-screen (ela…
Browse files Browse the repository at this point in the history
…stic elastic#181408) (elastic#197063)

fixes [181408](elastic#181408)

## Summary

This PR addresses the issue where the Observability AI Assistant input
box can be resized outside the boundaries of the browser window. Allows
the input box to resize dynamically while ensuring it remains usable,
even when the cursor moves outside the screen during resizing.
  • Loading branch information
arturoliduena authored Oct 30, 2024
1 parent 4d4de51 commit 731c5a4
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ export function PromptEditorNaturalLanguage({
}
}, [handleResizeTextArea, prompt]);

useEffect(() => {
// Attach the event listener to the window to catch mouseup outside the browser window
window.addEventListener('mouseup', handleResizeTextArea);

return () => {
window.removeEventListener('mouseup', handleResizeTextArea);
};
}, [handleResizeTextArea]);

return (
<EuiInputPopover
display="flex"
Expand Down

0 comments on commit 731c5a4

Please sign in to comment.