Skip to content

Commit b1ee4e4

Browse files
HerrTopiclaude
andcommitted
fix(ui-dialog): allow consumers to override inherited border-radius
The dialog forced `border-radius: inherit` via an inline style so that content like Menu and DateInput could inherit a wrapping View's radius. Inline styles (and an equivalent emotion `css` rule) cannot be overridden by a consumer's own `css` prop, so components like Modal could not set their own border-radius. Wrap the `inherit` rule in an `@layer` cascade layer instead. Unlayered consumer styles always win over layered ones regardless of specificity or source order, so an explicit border-radius from Modal takes effect while the inherit fallback still applies when no radius is provided. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b9ff437 commit b1ee4e4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/ui-dialog/src/Dialog/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
import { Component } from 'react'
26+
import { css } from '@emotion/react'
2627

2728
import { omitProps, getElementType } from '@instructure/ui-react-utils'
2829
import { findDOMNode, requestAnimationFrame } from '@instructure/ui-dom-utils'
@@ -173,7 +174,11 @@ class Dialog extends Component<DialogProps> {
173174
role === 'dialog' && this.props.shouldContainFocus ? true : undefined
174175
}
175176
className={this.props.className} // TODO in V2 remove className, there is no usage of it.
176-
style={{ borderRadius: 'inherit' }} // ensure the dialog inherits border radius from View
177+
css={css`
178+
@layer dialogBase {
179+
& { border-radius: inherit; }
180+
}
181+
`} //making sure it inherits from containers if nothing is specified from outside and use the outside specifiers if they are present, e.g.:modal
177182
ref={this.getRef}
178183
>
179184
{this.props.children}

0 commit comments

Comments
 (0)