Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat(trace-details): Pretty View interaction polish (hover, search, actions, z-index) (#11940)

Aditya Singhdb2e29dde996
diff --git a/frontend/src/components/cmdKPalette/cmdKPalette.scss b/frontend/src/components/cmdKPalette/cmdKPalette.scss
index fe07ae3c6b..272eecbc21 100644
--- a/frontend/src/components/cmdKPalette/cmdKPalette.scss
+++ b/frontend/src/components/cmdKPalette/cmdKPalette.scss
@@ -1,12 +1,12 @@
/* Overlay stays below content */
[data-slot='dialog-overlay'] {
- z-index: 50;
+ z-index: 1000 !important;
}
/* Dialog content always above overlay */
[data-slot='dialog-content'] {
position: fixed;
- z-index: 60;
+ z-index: 1001 !important;
background: var(--l1-background);
color: var(--l1-foreground);
diff --git a/frontend/src/periscope/components/DataViewer/DataViewer.styles.scss b/frontend/src/periscope/components/DataViewer/DataViewer.styles.scss
index 2b009a9f36..bc3a9f30f4 100644
--- a/frontend/src/periscope/components/DataViewer/DataViewer.styles.scss
+++ b/frontend/src/periscope/components/DataViewer/DataViewer.styles.scss
@@ -12,24 +12,13 @@
padding-bottom: 8px;
}
- &__mode-select {
- min-width: 90px;
- }
-
- // Dropdown content is rendered in a portal; bump above FloatingPanel
- // (z-index 999) so it stays visible when the consumer panel is floating.
- &__mode-dropdown {
- --dropdown-menu-content-z-index: 1000;
- }
-
// Shared content container — no scroll, each view handles its own
&__content {
flex: 1;
display: flex;
flex-direction: column;
border: 1px solid var(--l2-border);
- border-radius: 4px;
- padding: 8px;
+ border-top: 0px;
min-height: 0;
}
}
diff --git a/frontend/src/periscope/components/DataViewer/DataViewer.tsx b/frontend/src/periscope/components/DataViewer/DataViewer.tsx
index df50f7372b..01d2ee06fb 100644
--- a/frontend/src/periscope/components/DataViewer/DataViewer.tsx
+++ b/frontend/src/periscope/components/DataViewer/DataViewer.tsx
@@ -1,7 +1,5 @@
import { useMemo, useState } from 'react';
-import { ChevronDown } from '@signozhq/icons';
-import { Button } from '@signozhq/ui/button';
-import { DropdownMenuSimple as Dropdown } from '@signozhq/ui/dropdown-menu';
+import { ToggleGroupSimple } from '@signozhq/ui/toggle-group';
import logEvent from 'api/common/logEvent';
import CopyButton from 'periscope/components/CopyButton/CopyButton';
import { JsonView } from 'periscope/components/JsonView';
@@ -9,13 +7,16 @@ import { PrettyView, PrettyViewProps } from 'periscope/components/PrettyView';
import './DataViewer.styles.scss';
-type ViewMode = 'pretty' | 'json';
+enum ViewMode {
+ Pretty = 'pretty',
+ Json = 'json',
+}
const VIEW_MODE_CHANGED_EVENT = 'Data Viewer: View mode changed';
const VIEW_MODE_OPTIONS: { label: string; value: ViewMode }[] = [
- { label: 'Pretty', value: 'pretty' },
- { label: 'JSON', value: 'json' },
+ { label: 'Pretty', value: ViewMode.Pretty },
+ { label: 'JSON', value: ViewMode.Json },
];
export interface DataViewerProps {
@@ -30,12 +31,17 @@ function DataViewer({
drawerKey = 'default',
prettyViewProps,
}: DataViewerProps): JSX.Element {
- const [viewMode, setViewMode] = useState<ViewMode>('pretty');
+ const [viewMode, setViewMode] = useState<ViewMode>(ViewMode.Pretty);
const jsonString = useMemo(() => JSON.stringify(data, null, 2), [data]);
const handleViewModeChange = (value: string): void => {
const next = value as ViewMode;
+ // A single-select toggle can emit '' when the active item is toggled off;
+ // ignore it so one mode is always selected.
+ if (next !== ViewMode.Pretty && next !== ViewMode.Json) {
+ return;
+ }
setViewMode(next);
try {
logEvent(VIEW_MODE_CHANGED_EVENT, {
@@ -48,49 +54,25 @@ function DataViewer({
}
};
- const currentLabel =
- VIEW_MODE_OPTIONS.find((opt) => opt.value === viewMode)?.label ?? 'Pretty';
-
return (
<div className="data-viewer">
<div className="data-viewer__toolbar">
- <Dropdown
- align="start"
- className="data-viewer__mode-dropdown"
- menu={{
- items: [
- {
- type: 'radio-group',
- value: viewMode,
- onChange: handleViewModeChange,
- children: VIEW_MODE_OPTIONS.map((opt) => ({
- type: 'radio',
- key: opt.value,
- value: opt.value,
- label: opt.label,
- })),
- },
- ],
- }}
- >
- <Button
- variant="outlined"
- size="sm"
- color="secondary"
- className="data-viewer__mode-select"
- suffix={<ChevronDown size={12} />}
- >
- {currentLabel}
- </Button>
- </Dropdown>
+ <ToggleGroupSimple
+ type="single"
+ size="sm"
+ value={viewMode}
+ onChange={handleViewModeChange}
+ items={VIEW_MODE_OPTIONS}
+ testId="data-viewer-view-mode"
+ />
<CopyButton value={jsonString} ariaLabel="Copy JSON" />
</div>
<div className="data-viewer__content">
- {viewMode === 'pretty' && (
+ {viewMode === ViewMode.Pretty && (
<PrettyView data={data} drawerKey={drawerKey} {...prettyViewProps} />
)}
- {viewMode === 'json' && <JsonView data={jsonString} />}
+ {viewMode === ViewMode.Json && <JsonView data={jsonString} />}
</div>
</div>
);
diff --git a/frontend/src/periscope/components/JsonView/JsonView.tsx b/frontend/src/periscope/components/JsonView/JsonView.tsx
index 1d61472e57..c6f874b7d1 100644
--- a/frontend/src/periscope/components/JsonView/JsonView.tsx
+++ b/frontend/src/periscope/components/JsonView/JsonView.tsx
@@ -23,6 +23,9 @@ const editorOptions: EditorProps['options'] = {
lineHeight: 18,
colorDecorators: true,
scrollBeyondLastLine: false,
+ // Disabled: the transparent editor background leaves the sticky-scroll widget
+ // without an opaque backing, so scrolling lines bleed through and overlap it.
+ stickyScroll: { enabled: false },
scrollbar: {
vertical: 'hidden',
horizontal: 'hidden',
diff --git a/frontend/src/periscope/components/PrettyView/PrettyView.styles.scss b/frontend/src/periscope/components/PrettyView/PrettyView.styles.scss
index 78c795983a..ec7ffe6972 100644
--- a/frontend/src/periscope/components/PrettyView/PrettyView.styles.scss
+++ b/frontend/src/periscope/components/PrettyView/PrettyView.styles.scss
@@ -12,8 +12,10 @@
&__search-input {
width: 100%;
- border: 1px solid var(--l2-border) !important;
- border-radius: 4px;
+ border: 0 !important;
+ border-top: 1px solid var(--l2-border) !important;
+ border-bottom: 1px solid var(--l2-border) !important;
+ border-radius: 0 !important;
font-family: 'SF Mono', 'Geist Mono', 'Fira Code', monospace !important;
font-size: 12px !important;
line-height: 18px !important;
@@ -22,6 +24,7 @@
box-shadow: none !important;
&:focus {
+ border: 1px solid var(--l2-border) !important;
border-color: var(--primary) !important;
outline: none !important;
box-shadow: none !important;
@@ -47,6 +50,9 @@
> ul,
&__pinned > ul {
padding-left: 0 !important;
+ // Clip the hover bleed to the panel width. `clip` (not `hidden`) does
+ // not create a scroll container, so the sticky search stays working.
+ overflow-x: clip;
}
// Force font on all tree elements
@@ -71,45 +77,87 @@
margin-right: 16px;
}
- // Leaf node row — hover highlights only this row
+ // Leaf node row — full-width hover highlight
&__row {
- border-radius: 2px;
display: flex !important;
align-items: baseline;
+ position: relative;
+ isolation: isolate; // own stacking context so ::before sits behind content, not the panel bg
- &:hover {
- background-color: var(--l3-background);
+ // Keep actions visible on hover, or while this row's menu is open
+ &:hover .pretty-view__actions,
+ &:has(> span [data-state='open']) .pretty-view__actions {
+ opacity: 1;
+ }
- .pretty-view__actions {
- opacity: 1;
- }
+ // Edge-to-edge highlight, bled past indentation, clipped by `> ul`.
+ // Persists while this row's ... menu is open (the trigger stays in the
+ // row and carries data-state=open, even though the menu is portaled out).
+ &:hover::before,
+ &:has(> span [data-state='open'])::before {
+ content: '';
+ position: absolute;
+ inset: 0 -9999px;
+ background: var(--l3-background);
+ z-index: -1;
}
// Push actions to the right edge
> span {
flex: 1;
}
+
+ // Brighten the value text from its default grey to foreground-hover
+ // while the row is active (hover, or its ... menu open). !important
+ // overrides react-json-tree's per-type inline color on the value span.
+ &:hover > span,
+ &:has(> span [data-state='open']) > span {
+ color: var(--l1-foreground-hover) !important;
+ }
}
- // Nested node (object/array) — hover only on the label line, not children
+ // Nested node (object/array) — full-width hover on the header line only
&__nested-row {
+ position: relative;
+ isolation: isolate;
+
> label,
> span:not(ul span) {
- border-radius: 2px;
padding: 1px 2px;
display: inline !important; // keep item string inline with label
}
- // Highlight label + item string on hover, show actions
- &:hover > label,
- &:hover > label + span {
- background-color: var(--l3-background);
+ // Edge-to-edge highlight, capped to the header line so it doesn't
+ // cover the children this <li> contains. Persists while this row's own
+ // menu is open — `> span` scopes it so a child row's open menu (nested
+ // in `> ul`) doesn't light up this parent.
+ &:hover::before,
+ &:has(> span [data-state='open'])::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ height: 20px; // 18px line-height + 2px top padding
+ left: -9999px;
+ right: -9999px;
+ background: var(--l3-background);
+ z-index: -1;
}
- &:hover > label + span .pretty-view__actions {
+ &:hover > label + span .pretty-view__actions,
+ &:has(> span [data-state='open']) > label + span .pretty-view__actions {
opacity: 1;
}
+ // Push the ... to the right edge of the row instead of hugging the key.
+ // Absolute (not flex) so the arrow/label/children layout stays intact;
+ // the row <li> is position: relative (react-json-tree sets it inline).
+ .pretty-view__actions {
+ position: absolute;
+ top: 2px; // align with the header line (li padding-top)
+ right: 0;
+ height: 18px; // line-height — centers the icon (span is align-items: center)
+ }
+
// In nested rows, value-row should not take full width
.pretty-view__value-row {
width: auto;
@@ -172,6 +220,7 @@
display: inline-flex;
align-items: baseline;
gap: 6px;
+ padding-left: 6px !important;
}
&__pinned-icon {