Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
ArrowTab allows you to navigate a webpage using the arrow keys, automatically selecting the nearest focusable element. This enables fast and efficient keyboard-only navigation across the page.
ArrowTab is particularly useful for business applications, where power users need to prioritize high productivity.
Instead of hitting Tab
repeatedly, you can simply use the arrow keys to indicate the direction and jump to the next input, button, or link you want to select.
ArrowTab's default settings work well, but they are not always a plug-and-play solution. It helps if you build your app with ArrowTab in mind. For example, aligning your focusable elements into a grid and considering the placement of your navigation. The idea is to integrate ArrowTab into your app from the beginning, not to add it as an afterthought.
ArrowTab slightly modifies the behavior of some input elements to enhance keyboard navigation. For example, number inputs will not change their value when using the up and down arrow keys; instead, the focus will move to the element above or below.
To revert to the native behavior, press Shift
+ Arrow Key
.
pnpm:
pnpm install arrowtab
yarn:
yarn add arrowtab
npm:
npm install arrowtab
Vanilla JS:
import { initArrowTab } from 'arrowtab'
initArrowTab()
React:
'use client'
import { useEffect } from 'react'
import { initArrowTab } from 'arrowtab'
export const ArrowTab = () => {
useEffect(() => {
const { cleanup } = initArrowTab()
return () => {
cleanup()
}
}, [])
return null
}
If you want to remove the ArrowTab event listener, you can call the cleanup
function. This is useful if you use ArrowTab in a useEffect
hook.
const { cleanup } = initArrowTab()
cleanup()
You can pass options to the initArrowTab
function. For example:
initArrowTab({
debug: true,
autoDetectHistory: true,
})
default: false
If debug is set to true
, ArrowTab will log debug information to the console. It also enables the visual debug mode. To activate the visual debug mode, press Ctrl
+ Arrow Key
. For example, Ctrl
+ Arrow Down
will highlight all the focusable elements.
Here is an example:
Blue indicates the current element. Green indicates focusable elements that are within reach, and red indicates those that are not within reach.
The numbers represent the order of the focusable elements. The numbers in parentheses represent the order of the focusable elements that are within reach. Lower numbers are closer to the current element.
If you click on a focusable element, debug information will be logged to the console.
To deactivate the visual debug mode, press Esc
.
default: false
If true
, ArrowTab will automatically detect dialogs and refocuses the last focused element when the dialog closes.
You can control the behavior of ArrowTab by adding a data-arrowtab
attribute to any element. Separate the keywords with a space. For example: <div data-arrowtab="disable-left disable-right">
Here are the available keywords:
Sometimes your components are listening to arrow keys themselves. In that case, you can disable ArrowTab for that element by adding the disable
attribute.
If you only want to disable a specific key, then use: disable-left
, disable-right
, disable-up
, disable-down
.
pnpm dev
A demo page will open in your browser at http://localhost:8080
.
If you want to use the library in your app, you can use the following code:
import { initArrowTab } from 'http://localhost:8080/dist/index.js'
initArrowTab()
Or as a script tag:
<script type="module">
import { initArrowTab } from 'http://localhost:8080/dist/index.js'
initArrowTab()
</script>
FAQs
Use arrow keys to "tab" between focusable elements
The npm package arrowtab receives a total of 31 weekly downloads. As such, arrowtab popularity was classified as not popular.
We found that arrowtab 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.