Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@zendeskgarden/container-focusjail
Advanced tools
Containers relating to focusjail in the Garden Design System
This package includes containers relating to focus looping in the Garden Design System.
npm install @zendeskgarden/container-focusjail
This container implements the dialog focus loop design pattern and can be used to build a modal component. Check out storybook for live examples.
The useFocusJail
hook allows you to trap focus to a container element. Useful
for modals and widgets. Garden uses this in react-components for the modals package.
import { useRef } from 'react';
import { useFocusJail } from '@zendeskgarden/container-focusjail';
const FocusJail = () => {
const containerRef = useRef(null);
const { getContainerProps } = useFocusJail({
focusOnMount: false,
environment: window.parent.document,
containerRef
});
return (
<>
<input />
<div {...getContainerProps({ ref: containerRef, tabIndex: -1 })}>
<p>Focus is locked within the parent element</p>
<input />
<button>Focusable Items</button>
</div>
</>
);
};
FocusJailContainer
is a render-prop wrapper for the useFocusJail
hook.
import { createRef } from 'react';
import { FocusJailContainer } from '@zendeskgarden/container-focusjail';
const containerRef = createRef(null);
<FocusJailContainer
containerRef={containerRef}
focusOnMount={false}
environment={window.parent.document}
>
{({ getContainerProps }) => (
<>
<input />
<div {...getContainerProps({ ref: containerRef, tabIndex: -1 })}>
<p>Focus is locked within the parent element</p>
<input />
<button>Focusable Items</button>
</div>
</>
)}
</FocusJailContainer>;
FAQs
Containers relating to focusjail in the Garden Design System
The npm package @zendeskgarden/container-focusjail receives a total of 179,093 weekly downloads. As such, @zendeskgarden/container-focusjail popularity was classified as popular.
We found that @zendeskgarden/container-focusjail demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.