Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/upgrading/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ type: embed
added={[
{name:"borderWidth",note:""},
{name:"inverseBorderColor",note:""},
{name:"fullScreenMargin",note:""},
]}
changed={[
{oldName:"background",newName:"backgroundColor",note:""},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"jsdom": "^26.1.0",
"lerna": "9.0.7",
"lint-staged": "^16.4.0",
"prettier": "2.8.8",
"react": "18.3.1",
"typescript": "6.0.3",
"typescript-eslint": "^8.59.1",
Expand Down
7 changes: 5 additions & 2 deletions packages/ui-modal/src/Modal/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ const Example = () => {
background="primary-inverse"
margin="medium auto none"
display="block"
width="25rem"
height="25rem"
width="30rem"
height="30rem"
borderWidth="large"
id="constrainExample"
></View>
Expand Down Expand Up @@ -464,6 +464,9 @@ const Example = () => {
<Modal
open={open}
size={smallViewport ? 'fullscreen' : 'small'}
// Simulate real small-screen behavior by themeOverride.
// On actual small screens this happens automatically, so no theme override is needed.
themeOverride={smallViewport ? { fullScreenMargin: '0', borderRadius: '0' } : undefined}
onDismiss={(event) => {
if (event.target.id !== 'toggleViewportButton') {
setOpen(false)
Expand Down
17 changes: 14 additions & 3 deletions packages/ui-modal/src/Modal/v2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

import { boxShadowObjectsToCSSString } from '@instructure/ui-themes'
import type { NewComponentTypes } from '@instructure/ui-themes'
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
import type { ModalProps, ModalStyle } from './props'

/**
Expand All @@ -39,7 +39,8 @@ import type { ModalProps, ModalStyle } from './props'
*/
const generateStyle = (
componentTheme: ReturnType<NewComponentTypes['Modal']>,
props: ModalProps
props: ModalProps,
sharedTokens: SharedTokens
): ModalStyle => {
const { size, variant, overflow } = props

Expand Down Expand Up @@ -75,7 +76,17 @@ const generateStyle = (
height: '100%',
boxShadow: 'none',
border: 'none',
borderRadius: 0
borderRadius: 0,
// On larger screens, inset the fullscreen modal from the viewport edge
// for a11y: the Mask flex-centers it, so `flex: 1` + `alignSelf: stretch`
// (auto height) gap it evenly via the margin; corners/shadow restored too.
[`@media screen and (min-width: ${sharedTokens.breakpoints.md})`]: {
margin: componentTheme.fullScreenMargin,
height: 'auto',
alignSelf: 'stretch',
borderRadius: componentTheme.borderRadius,
boxShadow: boxShadowObjectsToCSSString(componentTheme.boxShadow)
}
}
}
const backgroundStyles =
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading