diff --git a/package-lock.json b/package-lock.json index 680749124f7..a8504a0d680 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,8 +81,8 @@ "react-dom": "^18.3.1" }, "devDependencies": { - "@primer/react": "38.9.0", - "@primer/styled-react": "1.0.2", + "@primer/react": "38.10.0", + "@primer/styled-react": "1.0.3", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.3", @@ -95,8 +95,8 @@ "name": "example-nextjs", "version": "0.0.0", "dependencies": { - "@primer/react": "38.9.0", - "@primer/styled-react": "1.0.2", + "@primer/react": "38.10.0", + "@primer/styled-react": "1.0.3", "next": "^16.1.5", "react": "^19.2.0", "react-dom": "^19.2.0", @@ -138,8 +138,8 @@ "version": "0.0.0", "dependencies": { "@primer/octicons-react": "^19.21.0", - "@primer/react": "38.9.0", - "@primer/styled-react": "1.0.2", + "@primer/react": "38.10.0", + "@primer/styled-react": "1.0.3", "clsx": "^2.1.1", "next": "^16.1.5", "react": "^19.2.0", @@ -6482,9 +6482,9 @@ } }, "node_modules/@primer/behaviors": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@primer/behaviors/-/behaviors-1.10.0.tgz", - "integrity": "sha512-+GaAqCJuoYVf0Sy67mJfhw7k17nrCnfanI4H6NFEyToDC1ghrOC9Yl7627WTWpqGg+1lPhjF7OHF7VClLz52oA==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/@primer/behaviors/-/behaviors-1.10.2.tgz", + "integrity": "sha512-93juWZbWg2DRhC11+7RT7hMpY1VD3lBosLmccqEZ65yrCHqkBCjI8Uj8wxs3y0U+wWE07LAoLHAPylyWbifg5A==", "license": "MIT" }, "node_modules/@primer/css": { @@ -27004,7 +27004,7 @@ }, "packages/react": { "name": "@primer/react", - "version": "38.9.0", + "version": "38.10.0", "license": "MIT", "dependencies": { "@github/mini-throttle": "^2.1.1", @@ -27012,7 +27012,7 @@ "@github/tab-container-element": "^4.8.2", "@lit-labs/react": "1.2.1", "@oddbird/popover-polyfill": "^0.5.2", - "@primer/behaviors": "^1.10.0", + "@primer/behaviors": "^1.10.2", "@primer/live-region-element": "^0.7.1", "@primer/octicons-react": "^19.21.0", "@primer/primitives": "10.x || 11.x", @@ -27374,7 +27374,7 @@ }, "packages/styled-react": { "name": "@primer/styled-react", - "version": "1.0.2", + "version": "1.0.3", "dependencies": { "@styled-system/css": "^5.1.5", "@styled-system/props": "^5.1.5", @@ -27388,7 +27388,7 @@ "@babel/preset-react": "^7.28.5", "@babel/preset-typescript": "^7.28.5", "@primer/primitives": "10.x || 11.x", - "@primer/react": "^38.4.0", + "@primer/react": "^38.10.0", "@rollup/plugin-babel": "^6.1.0", "@storybook/react-vite": "^10.1.11", "@types/react": "18.3.11", diff --git a/packages/react/package.json b/packages/react/package.json index b0961635f67..67fcd5e655e 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -79,7 +79,7 @@ "@github/tab-container-element": "^4.8.2", "@lit-labs/react": "1.2.1", "@oddbird/popover-polyfill": "^0.5.2", - "@primer/behaviors": "^1.10.0", + "@primer/behaviors": "^1.10.2", "@primer/live-region-element": "^0.7.1", "@primer/octicons-react": "^19.21.0", "@primer/primitives": "10.x || 11.x", diff --git a/packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx b/packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx index 36f6481dd40..7391258896d 100644 --- a/packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx +++ b/packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import {ActionMenu, ActionList, Button, IconButton, FormControl, TextInput} from '../' +import React, {useState, useCallback} from 'react' +import {ActionMenu, ActionList, Button, IconButton, FormControl, TextInput, Dialog, Text} from '../' import { GearIcon, MilestoneIcon, @@ -654,3 +654,104 @@ export const DynamicAnchorSides = () => { ) } + +export const InsideDialog = () => { + const [isDialogOpen, setIsDialogOpen] = useState(false) + + const onDialogClose = useCallback(() => setIsDialogOpen(false), []) + const openDialog = useCallback(() => setIsDialogOpen(true), []) + + // Create scrollable content with multiple paragraphs + const scrollableContent = Array.from({length: 50}, (_, index) => ( + + This is paragraph {index + 1}. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. + + )) + + return ( +
+ {/* Main scrollable content */} +
+ + Main Page Content + + + + + {/* Show more content after the button to make it scrollable */} + {scrollableContent} +
+ + {/* Dialog containing ActionMenu */} + {isDialogOpen && ( + + + This dialog contains an ActionMenu. The main page content behind is long enough to be scrollable. + + + + Document Settings + + + + Configure the document properties and sharing settings. These options allow you to control how the document + is displayed and who has access to it. + + + + Actions + + + alert('Save clicked')}> + Save + ⌘S + + alert('Save as clicked')}> + Save as... + ⌘⇧S + + alert('Export clicked')}> + Export + ⌘E + + alert('Print clicked')}> + Print + ⌘P + + + alert('Copy clicked')}> + Copy + ⌘C + + alert('Paste clicked')}> + Paste + ⌘V + + alert('Duplicate clicked')}> + Duplicate + ⌘D + + + alert('Share clicked')}> + Share + ⌘⇧U + + alert('Share via email clicked')}>Share via email + alert('Share via link clicked')}>Share via link + + + + + + You can interact with the ActionMenu above while the main page content remains scrollable in the background. + + + )} +
+ ) +} diff --git a/packages/react/src/ActionMenu/ActionMenu.module.css b/packages/react/src/ActionMenu/ActionMenu.module.css index 4c9b063d239..a6faaed8413 100644 --- a/packages/react/src/ActionMenu/ActionMenu.module.css +++ b/packages/react/src/ActionMenu/ActionMenu.module.css @@ -1,4 +1,7 @@ .ActionMenuContainer { + /* add default max height */ + max-height: 100vh; + &:where([data-variant='fullscreen']) { padding-top: var(--base-size-36); } diff --git a/packages/react/src/ActionMenu/ActionMenu.tsx b/packages/react/src/ActionMenu/ActionMenu.tsx index 7e97ae4d673..3e1233ff55b 100644 --- a/packages/react/src/ActionMenu/ActionMenu.tsx +++ b/packages/react/src/ActionMenu/ActionMenu.tsx @@ -256,7 +256,7 @@ const defaultVariant: ResponsiveValue<'anchored', 'anchored' | 'fullscreen'> = { } type MenuOverlayProps = Partial & - Pick & { + Pick & { /** * Recommended: `ActionList` */ @@ -268,6 +268,7 @@ const Overlay: FCWithSlotMarker> = ({ align = 'start', side, onPositionChange, + displayInViewport, 'aria-labelledby': ariaLabelledby, variant = defaultVariant, ...overlayProps @@ -331,6 +332,7 @@ const Overlay: FCWithSlotMarker> = ({ focusZoneSettings={isNarrowFullscreen ? {disabled: true} : {focusOutBehavior: 'wrap'}} onPositionChange={onPositionChange} variant={variant} + displayInViewport={displayInViewport} >
> + Partial> const defaultVariant = { regular: 'anchored', @@ -151,6 +151,7 @@ export const AnchoredOverlay: React.FC