From c9e68d2fb010e30fbc0a925282a6cf790176937c Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Mon, 28 Oct 2024 13:42:02 -0400 Subject: [PATCH 1/5] AvatarStack: Adds back empty space in `AvatarStack` (#5181) * adds back empty space in `AvatarStack` * Update snapshot --- packages/react/src/AvatarStack/AvatarStack.tsx | 1 + .../react/src/__tests__/__snapshots__/AvatarStack.test.tsx.snap | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/react/src/AvatarStack/AvatarStack.tsx b/packages/react/src/AvatarStack/AvatarStack.tsx index 8430fc199b5..ccd87f1e24f 100644 --- a/packages/react/src/AvatarStack/AvatarStack.tsx +++ b/packages/react/src/AvatarStack/AvatarStack.tsx @@ -314,6 +314,7 @@ const AvatarStack = ({ tabIndex={!hasInteractiveChildren && !disableExpand ? 0 : undefined} ref={stackContainer} > + {' '} {transformChildren(children)} diff --git a/packages/react/src/__tests__/__snapshots__/AvatarStack.test.tsx.snap b/packages/react/src/__tests__/__snapshots__/AvatarStack.test.tsx.snap index cc28e33c219..8f68da6c108 100644 --- a/packages/react/src/__tests__/__snapshots__/AvatarStack.test.tsx.snap +++ b/packages/react/src/__tests__/__snapshots__/AvatarStack.test.tsx.snap @@ -188,6 +188,7 @@ exports[`Avatar respects alignRight props 1`] = ` className="pc-AvatarStackBody" tabIndex={0} > + Date: Mon, 28 Oct 2024 14:41:22 -0400 Subject: [PATCH 2/5] Overlay: Add proper roles w/ keyboard expectations to stories (#5175) * Add proper roles w/ keyboard expectations to stories * Make prop optional --- .../src/Overlay/Overlay.features.stories.tsx | 108 ++++++++++++++++-- 1 file changed, 99 insertions(+), 9 deletions(-) diff --git a/packages/react/src/Overlay/Overlay.features.stories.tsx b/packages/react/src/Overlay/Overlay.features.stories.tsx index ac35e8bfc5a..340181ab53c 100644 --- a/packages/react/src/Overlay/Overlay.features.stories.tsx +++ b/packages/react/src/Overlay/Overlay.features.stories.tsx @@ -1,6 +1,6 @@ import React, {useState, useRef, useCallback} from 'react' import type {Meta} from '@storybook/react' -import {TriangleDownIcon, PlusIcon, IssueDraftIcon} from '@primer/octicons-react' +import {TriangleDownIcon, PlusIcon, IssueDraftIcon, XIcon} from '@primer/octicons-react' import { Overlay, ButtonGroup, @@ -16,8 +16,10 @@ import { Label, ActionList, ActionMenu, + useFocusTrap, } from '..' import type {AnchorSide} from '@primer/behaviors' +import type {AriaRole} from '../utils/types' import {Tooltip} from '../TooltipV2' export default { @@ -25,6 +27,7 @@ export default { component: Overlay, args: { anchorSide: 'inside-top', + role: 'dialog', }, argTypes: { anchorSide: { @@ -43,16 +46,22 @@ export default { 'outside-right', ], }, + role: { + type: 'string', + }, }, } as Meta interface OverlayProps { - anchorSide: AnchorSide + anchorSide?: AnchorSide + role?: AriaRole + right?: boolean } export const DropdownOverlay = ({anchorSide}: OverlayProps) => { const [isOpen, setIsOpen] = useState(false) const buttonRef = useRef(null) + return ( <>