Skip to content

Commit

Permalink
fix a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
scurker committed Sep 30, 2024
1 parent 14e5ad1 commit c6fdb4e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
29 changes: 27 additions & 2 deletions docs/pages/components/BottomSheet.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: BottomSheet
description: A primitive component with an initially hidden off-screen container anchored to the bottom of the page to provide quick access to additional content or information.
description: A primitive component with an initially hidden off-screen overlay anchored to the bottom of the page to provide quick access to additional content or information.
source: https://github.com/dequelabs/cauldron/tree/develop/packages/react/src/components/BottomSheet/index.tsx
---

Expand All @@ -11,6 +11,8 @@ import { BottomSheet, IconButton, Icon, Button } from '@deque/cauldron-react'
import { BottomSheet } from '@deque/cauldron-react'
```

`BottomSheet` is an extension of the [`Drawer`](./Drawer) component to display additional information, typically on smaller devices.

## Examples

```jsx example
Expand All @@ -35,7 +37,30 @@ function BottomSheetExample() {
required: true
}}
refType="HTMLDivElement"
props={[]}
props={[
{
name: 'open',
type: 'boolean',
defaultValue: 'false',
description: 'Sets the current "open" state of the bottom sheet.'
},
{
name: 'focusOptions',
type: 'object',
description: 'Advanced customization of focus state when the bottom sheet open state changes.'
},
{
name: 'onClose',
type: 'function',
description: 'Callback function when the bottom sheet is closed.'
},
{
name: 'portal',
type: ['Element', 'React.RefObject<Element>'],
defaultValue: 'document.body',
description: 'Sets the container in which the bottom sheet is rendered.'
}
]}
/>

## Related Components
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/components/BottomSheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type BottomSheetProps = {
} & React.HTMLAttributes<HTMLDivElement> &
Pick<
React.ComponentProps<typeof Drawer>,
'open' | 'onClose' | 'focusOptions'
'open' | 'onClose' | 'focusOptions' | 'portal'
>;

const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
Expand Down Expand Up @@ -41,15 +41,15 @@ const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(

return (
<Drawer
behavior="modal"
position="bottom"
open={open}
onClose={handleClose}
focusOptions={{
initialFocus: bottomSheetRef,
...focusOptions
}}
onClose={handleClose}
{...props}
behavior="modal"
position="bottom"
>
<div
ref={bottomSheetRef}
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/components/Drawer/Drawer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ test('should not trap focus when behavior is non-modal', async () => {
</Drawer>
</>
);

expect(screen.getByRole('button', { name: 'outside' })).not.toHaveAttribute(
'aria-hidden',
'true'
Expand Down

0 comments on commit c6fdb4e

Please sign in to comment.