Commit ec67b3d
authored
[Markdown] Fix layout issues for markdown embeddables in small panels (elastic#240806)
## Summary
Fixes layout issues for markdown embeddables in small dashboard panels
using CSS container queries. When a markdown panel is shorter than
120px, the UI now adapts to a compact layout that maximizes usable
space.
## Problem
Markdown embeddables are not rendering correctly in small (short)
panels. The editor toolbar and footer would take up significant vertical
space, leaving little room for content editing in constrained layouts.
Turns out that this usecase can be more important to just ignore it,
since users might use small panels to only place the title in the
dashboard.
<img width="643" height="89" alt="Screenshot 2025-10-27 at 14 08 42"
src="https://github.com/user-attachments/assets/b3478586-13d0-4ef0-b5b5-617089886db3"
/>
## Solution
### Layout Improvements
Implemented responsive layout using CSS container queries (@container)
to detect when panels are too small and automatically switch to a
compact layout:
When container height < 120px:
- Editor toolbar is hidden to maximize editing space - toolbar can be
useful but it's not essential for the users to edit their markdown
panels.
- Footer transforms to compact overlay positioned in the top-right
corner with transparent background
<img width="640" height="83" alt="Screenshot 2025-10-27 at 14 08 17"
src="https://github.com/user-attachments/assets/14582c1a-1f56-42bf-9f63-4bd1a1add77e"
/>
The new layout
<img width="581" height="186" alt="Screenshot 2025-10-27 at 14 13 31"
src="https://github.com/user-attachments/assets/8982f333-5133-4fbb-b94b-815cb28b61de"
/>
The smallest layout that still follows the 'classic' design1 parent 73ec8eb commit ec67b3d
File tree
2 files changed
+32
-7
lines changed2 files changed
+32
-7
lines changedLines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
46 | 58 | | |
47 | 59 | | |
48 | 60 | | |
| |||
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
85 | | - | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
| |||
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
120 | | - | |
| 132 | + | |
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
| |||
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | | - | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
43 | 59 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 60 | | |
48 | 61 | | |
49 | 62 | | |
| |||
0 commit comments