
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
pentonville
Advanced tools
A React component for capturing tab and managing focus events.
<Pentonville>
<form>
<input name='one' />
<input name='two' />
</form>
</Pentonville>
Once focus enters Pentonville it cannot leave.
Every <form /> input element has an implicit tab index which enables them to accept focus, and be tabbed between, from one to another, in the order they appear in the document. The value of the implicit tab index is 0.
Some other HTML elements can be made to accept focus with an explicit tab index of the same value.
<p tabindex="0">
This paragraph can accept focus.
</p>
In React the attribute is in camel case but is otherwise the same.
<p tabIndex='0'>
This paragraph can accept focus.
</p>
(You didn't need a nearly identical second example, but there it is.)
An element can also be given an explicit negative tab index of -1 (to remove it from the tab flow), or an explicit positive tab index of 1 or more (to change its position in the tab flow).
Positive tab indexes are tabbed to in sequence, from the lowest to the highest value, regardless of their order in the document. After reaching the highest value, flow returns to the elements with a zero index, whether implicit and explicit, such that they are tabbed to in sequence, according to their order in the document.
Sometimes it is desirable to prevent tab flow and focus from moving beyond the boundary of a set of HTML elements. Pentonville is that boundary: once focus has entered, it won't escape.
Tab flow is maintained by moving focus through the order of each element's tab index, from the first to the last, when tab flow is returned to the first element again.
Focus can be put on any element in the sequence, in which case it will proceed according to the tab index. In other words: focus can be put onto an element with a tab index value of 3 and have the next element in the tab flow be the element with a tab index of 4, then 5 and so on, until the positive tab index values have been exhausted and flow proceeds through each element with a tab index of 0, then onto 1 and 2 and back to 3 again.
Focus cannot be put onto any other element. Pentonville won't permit it. Focus will be maintained on whichever element within Pentonville currently has it.
Example Storybooks are available on GitHub.
Clone the repository, then:
npm install
npm run storybook
And with your preferred browser visit http://localhost:6006.
(The Storybooks are not meant to be visually pleasing: they are examples only of the component's behaviour.)
FAQs
Pentonville
The npm package pentonville receives a total of 57 weekly downloads. As such, pentonville popularity was classified as not popular.
We found that pentonville demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.