From c30765bbeac13d5b8f30d2bbac918cc96f3014d0 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:15:31 +0100 Subject: [PATCH] Dashboards: A11y improvements for edit experience (#106321) * Dashboards: A11y improvements for edit experience * Pass descriptor to render function --- .../edit-pane/VizPanelEditableElement.tsx | 11 ++++-- .../panel-edit/getPanelFrameOptions.tsx | 34 +++++++++++++------ .../layout-auto-grid/AutoGridItemEditor.tsx | 7 ++-- .../DashboardGridItemEditor.tsx | 7 ++-- .../PanelEditor/OptionsPaneItemDescriptor.tsx | 6 ++-- .../PanelEditor/getPanelFrameOptions.tsx | 20 ++++++----- 6 files changed, 54 insertions(+), 31 deletions(-) diff --git a/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx b/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx index 5d7e1485cbb..58f6d2c2ddd 100644 --- a/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx +++ b/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx @@ -55,22 +55,27 @@ export class VizPanelEditableElement implements EditableDashboardElement, BulkAc .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.viz-panel.options.title-option', 'Title'), + id: 'PanelFrameTitle', value: panel.state.title, popularRank: 1, - render: () => , + render: (descriptor) => ( + + ), }) ) .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.viz-panel.options.description', 'Description'), + id: 'description-text-area', value: panel.state.description, - render: () => , + render: (descriptor) => , }) ) .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.viz-panel.options.transparent-background', 'Transparent background'), - render: () => , + id: 'transparent-background', + render: (descriptor) => , }) ); }, [panel, isNewElement]); diff --git a/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx b/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx index 6821a05e542..75fd0c1ef2a 100644 --- a/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx +++ b/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx @@ -37,10 +37,11 @@ export function getPanelFrameOptions(panel: VizPanel): OptionsPaneCategoryDescri .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard-scene.get-panel-frame-options.title.title', 'Title'), + id: 'PanelFrameTitle', value: panel.state.title, popularRank: 1, - render: function renderTitle() { - return ; + render: function renderTitle(descriptor) { + return ; }, addon: config.featureToggles.dashgpt && ( ; + render: function renderDescription(descriptor) { + return ; }, addon: config.featureToggles.dashgpt && ( ; + id: 'transparent-background', + render: function renderTransparent(descriptor) { + return ; }, }) ) @@ -112,7 +115,15 @@ function ScenePanelLinksEditor({ panelLinks }: ScenePanelLinksEditorProps) { ); } -export function PanelFrameTitleInput({ panel, isNewElement }: { panel: VizPanel; isNewElement?: boolean }) { +export function PanelFrameTitleInput({ + panel, + isNewElement, + id, +}: { + panel: VizPanel; + isNewElement?: boolean; + id?: string; +}) { const { title } = panel.useState(); const notInPanelEdit = panel.getPanelContext().app !== CoreApp.PanelEditor; const [prevTitle, setPrevTitle] = React.useState(panel.state.title); @@ -125,6 +136,7 @@ export function PanelFrameTitleInput({ panel, isNewElement }: { panel: VizPanel; setPrevTitle(title)} onBlur={() => editPanelTitleAction(panel, title, prevTitle)} @@ -135,13 +147,13 @@ export function PanelFrameTitleInput({ panel, isNewElement }: { panel: VizPanel; ); } -export function PanelDescriptionTextArea({ panel }: { panel: VizPanel }) { +export function PanelDescriptionTextArea({ panel, id }: { panel: VizPanel; id?: string }) { const { description } = panel.useState(); const [prevDescription, setPrevDescription] = React.useState(panel.state.description); return (