From 4cb5cdf802fd05066104ce72dd08703316f0c691 Mon Sep 17 00:00:00 2001 From: Kim Doberstein Date: Thu, 12 Nov 2026 13:35:39 -0600 Subject: [PATCH 1/2] fix: support keyboard widget addition --- .../module/src/WidgetLayout/WidgetDrawer.tsx | 53 +++++++++++++------ .../module/src/WidgetLayout/WidgetLayout.tsx | 42 +++++++++++++++ .../__tests__/WidgetDrawer.test.tsx | 42 +++++++++++++++ .../__tests__/WidgetLayout.test.tsx | 40 ++++++++++++++ packages/module/src/styles.css | 18 +++++++ 5 files changed, 180 insertions(+), 15 deletions(-) diff --git a/packages/module/src/WidgetLayout/WidgetDrawer.tsx b/packages/module/src/WidgetLayout/WidgetDrawer.tsx index ace746b..a61aa71 100644 --- a/packages/module/src/WidgetLayout/WidgetDrawer.tsx +++ b/packages/module/src/WidgetLayout/WidgetDrawer.tsx @@ -16,6 +16,7 @@ import { import React, { useState } from 'react'; import CloseIcon from '@patternfly/react-icons/dist/esm/icons/close-icon'; import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon'; +import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon'; import { WidgetMapping, WidgetConfiguration } from './types'; export type WidgetDrawerProps = React.PropsWithChildren<{ @@ -33,23 +34,20 @@ export type WidgetDrawerProps = React.PropsWithChildren<{ onWidgetDragStart?: (widgetType: string) => void; /** Callback when widget drag ends */ onWidgetDragEnd?: () => void; + /** Callback when a widget is added with the keyboard */ + onWidgetAdd?: (widgetType: string) => void; + /** Whether additions are unavailable because the layout is locked */ + isDisabled?: boolean; }>; -const WidgetWrapper = ({ widgetType, config, onDragStart, onDragEnd }: { +const WidgetWrapper = ({ widgetType, config, onDragStart, onDragEnd, onAdd, isDisabled }: { widgetType: string; config?: WidgetConfiguration; onDragStart: (widgetType: string) => void; onDragEnd: () => void; -}) => { - const headerActions = ( - Drag to add widget

}> - - - -
- ); - - return ( + onAdd?: (widgetType: string) => void; + isDisabled?: boolean; +}) => ( { const nodeRect = (e.target as HTMLElement).getBoundingClientRect(); @@ -71,11 +69,33 @@ const WidgetWrapper = ({ widgetType, config, onDragStart, onDragEnd }: { onDragEnd={onDragEnd} unselectable="on" - draggable={true} + draggable={!isDisabled} className="pf-v6-widget-grid-tile" ouiaId={`add-widget-card-${config?.title || widgetType}`} > - + + Drag to add widget

}> + + + +
+