Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
fix: Add containerElement prop to customize devtools container elemen…
Browse files Browse the repository at this point in the history
…t, default to 'footer' (#77)
  • Loading branch information
mturley authored Nov 5, 2020
1 parent d1d15e1 commit e2b7527
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export function ReactQueryDevtools(props: {
* Defaults to 'bottom-left'.
*/
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
/**
* Use this to render the devtools inside a different type of container element for a11y purposes.
* Any string which corresponds to a valid intrinsic JSX element is allowed.
* Defaults to 'footer'.
*/
containerElement?: keyof JSX.IntrinsicElements
}): React.ReactElement

export function ReactQueryDevtoolsPanel(props: {
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function ReactQueryDevtools({
closeButtonProps = {},
toggleButtonProps = {},
position = 'bottom-left',
containerElement: Container = 'footer',
}) {
const rootRef = React.useRef()
const panelRef = React.useRef()
Expand Down Expand Up @@ -94,7 +95,7 @@ export function ReactQueryDevtools({
} = toggleButtonProps

return (
<div ref={rootRef} className="ReactQueryDevtools">
<Container ref={rootRef} className="ReactQueryDevtools">
{isResolvedOpen ? (
<ThemeProvider theme={theme}>
<ReactQueryDevtoolsPanel
Expand Down Expand Up @@ -192,7 +193,7 @@ export function ReactQueryDevtools({
<Logo aria-hidden />
</button>
)}
</div>
</Container>
)
}

Expand Down

0 comments on commit e2b7527

Please sign in to comment.