Skip to content

Commit e481373

Browse files
committed
fix(ui-alerts): no passthroughProps are set in component so Alert won't pass down props such as id to the underlaying DOM
INSTUI-4507
1 parent 5322f9c commit e481373

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/ui-alerts/src/Alert/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import keycode from 'keycode'
2828

2929
import {
3030
callRenderProp,
31-
withDeterministicId
31+
withDeterministicId,
32+
passthroughProps
3233
} from '@instructure/ui-react-utils'
3334
import { CloseButton } from '@instructure/ui-buttons'
3435
import { View } from '@instructure/ui-view'
@@ -257,16 +258,18 @@ class Alert extends Component<AlertProps, AlertState> {
257258
}
258259

259260
renderAlert() {
261+
const { margin, styles, children, ...props } = this.props
260262
return (
261263
<View
264+
{...passthroughProps({ ...props })}
262265
as="div"
263-
margin={this.props.margin}
264-
css={this.props.styles?.alert}
266+
margin={margin}
267+
css={styles?.alert}
265268
onKeyUp={this.handleKeyUp}
266269
elementRef={this.handleRef}
267270
>
268271
{this.renderIcon()}
269-
<div css={this.props.styles?.content}>{this.props.children}</div>
272+
<div css={styles?.content}>{children}</div>
270273
{this.renderCloseButton()}
271274
</View>
272275
)

0 commit comments

Comments
 (0)