Skip to content

Commit 574e258

Browse files
authored
[ES|QL] Fixes the visibility of the datepicker (#214728)
## Summary Fixes the visibility of the timepicker on the dashboard <img width="720" alt="image" src="https://github.com/user-attachments/assets/9fd40aa4-b334-4854-8b01-e106fd2e1f11" /> and the position in case the editor doesnt have a lot of space. in that scenario we move the timepicker to the right <img width="759" alt="image" src="https://github.com/user-attachments/assets/7a8dbccf-ae42-452a-9046-4308a2a783bb" />
1 parent eed0a19 commit 574e258

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/platform/packages/private/kbn-esql-editor/src/esql_editor.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import type { ESQLEditorProps, ESQLEditorDeps, ControlsContext } from './types';
5959

6060
// for editor width smaller than this value we want to start hiding some text
6161
const BREAKPOINT_WIDTH = 540;
62+
const DATEPICKER_WIDTH = 373;
6263

6364
const triggerControl = async (
6465
queryString: string,
@@ -255,8 +256,12 @@ export const ESQLEditor = memo(function ESQLEditor({
255256
const editorLeft = editorCoords.left;
256257

257258
// Calculate the absolute position of the popover
258-
const absoluteTop = editorTop + (editorPosition?.top ?? 0) + 20;
259-
const absoluteLeft = editorLeft + (editorPosition?.left ?? 0);
259+
const absoluteTop = editorTop + (editorPosition?.top ?? 0) + 25;
260+
let absoluteLeft = editorLeft + (editorPosition?.left ?? 0);
261+
if (absoluteLeft > editorCoords.width) {
262+
// date picker is out of the editor
263+
absoluteLeft = absoluteLeft - DATEPICKER_WIDTH;
264+
}
260265

261266
setPopoverPosition({ top: absoluteTop, left: absoluteLeft });
262267
datePickerOpenStatusRef.current = true;
@@ -887,6 +892,8 @@ export const ESQLEditor = memo(function ESQLEditor({
887892
borderRadius: theme.euiTheme.border.radius.small,
888893
position: 'absolute',
889894
overflow: 'auto',
895+
zIndex: 1001,
896+
border: theme.euiTheme.border.thin,
890897
}}
891898
ref={popoverRef}
892899
data-test-subj="ESQLEditor-timepicker-popover"

0 commit comments

Comments
 (0)