Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/utils

Package Overview
Dependencies
Maintainers
2
Versions
829
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/utils

Spectrum UI components in React

  • 3.0.0-nightly-25f304dea-241003
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
decreased by-12.99%
Maintainers
2
Weekly downloads
 
Created

What is @react-aria/utils?

The @react-aria/utils package provides a collection of utility functions that help in managing accessibility concerns in React applications. These utilities assist in handling keyboard, focus, and selection behaviors, making it easier to build accessible UI components.

What are @react-aria/utils's main functionalities?

Focus Management

This feature allows you to focus an element without causing the browser to scroll to it, which can be useful in maintaining the user's scroll position while programmatically moving focus.

import { focusWithoutScrolling } from '@react-aria/utils';

function handleFocus(element) {
  focusWithoutScrolling(element);
}

Keyboard Event Handling

This utility helps in filtering out non-DOM properties from props, ensuring that only valid HTML attributes are passed to the DOM element, thus preventing React warnings and improving HTML output.

import { filterDOMProps } from '@react-aria/utils';

function Button(props) {
  return <button {...filterDOMProps(props)}>Click me</button>;
}

Merge Props

Merge props from different sources, typically used to combine default and user-provided props in a component. It ensures that event handlers and other attributes are correctly combined and overridden if necessary.

import { mergeProps } from '@react-aria/utils';

function mergeComponentProps(userProps, defaultProps) {
  return mergeProps(defaultProps, userProps);
}

Other packages similar to @react-aria/utils

FAQs

Package last updated on 03 Oct 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc