diff --git a/src/calendar/grid/index.tsx b/src/calendar/grid/index.tsx index 6bb82b18b1..1cc76e36c0 100644 --- a/src/calendar/grid/index.tsx +++ b/src/calendar/grid/index.tsx @@ -47,22 +47,24 @@ export interface GridProps { renderDateAnnouncement: (date: Date, isOnCurrentDate: boolean) => string; isSameDate: (date: Date, baseDate: Date) => boolean; onGridKeyDownHandler: (event: React.KeyboardEvent) => void; + referrerId?: string; } interface GridCellProps extends TdHTMLAttributes { disabledReason?: string; + referrerId?: string; } const GridCell = forwardRef((props: GridCellProps, focusedDateRef: React.Ref) => { - const { disabledReason, ...rest } = props; + const { disabledReason, referrerId, ...rest } = props; const isDisabledWithReason = !!disabledReason; const { targetProps, descriptionEl } = useHiddenDescription(disabledReason); - const ref = useRef(null); + const cellRef = useRef(null); const [showTooltip, setShowTooltip] = useState(false); return ( (isDisabledWithReason ? setShowTooltip(true) : undefined)} @@ -77,9 +79,10 @@ const GridCell = forwardRef((props: GridCellProps, focusedDateRef: React.Ref ref.current} + getTrack={() => cellRef.current} content={disabledReason!} onEscape={() => setShowTooltip(false)} + referrerId={referrerId} /> )} @@ -105,6 +108,7 @@ export default function Grid({ renderDateAnnouncement, isSameDate, onGridKeyDownHandler, + referrerId, }: GridProps) { const focusedDateRef = useRef(null); @@ -166,6 +170,7 @@ export default function Grid({ [styles['calendar-date-dense']]: denseGrid, })} disabledReason={isDisabledWithReason ? disabledReason : undefined} + referrerId={referrerId} >