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

postcss-focus-within

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-focus-within

Use the :focus-within pseudo-selector in CSS

  • 9.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.5M
increased by7.59%
Maintainers
3
Weekly downloads
 
Created

What is postcss-focus-within?

The postcss-focus-within package is a PostCSS plugin that adds support for the :focus-within pseudo-class to CSS. This pseudo-class applies styles to an element if it or any of its descendants have focus. This is particularly useful for improving accessibility and user experience by providing visual feedback when interacting with form elements or other interactive components.

What are postcss-focus-within's main functionalities?

Basic Usage

This feature allows you to use the :focus-within pseudo-class in your CSS. The plugin will transform it into equivalent CSS that works in all browsers by applying the styles to the element itself and all its descendants.

/* Input CSS */
.container:focus-within {
  background-color: yellow;
}

/* Output CSS */
.container:focus,
.container *:focus {
  background-color: yellow;
}

Nested Focus

This feature allows you to apply styles to nested elements when any of the nested elements or their descendants are focused. The plugin ensures that the styles are applied correctly by transforming the CSS.

/* Input CSS */
.form:focus-within .input {
  border-color: blue;
}

/* Output CSS */
.form:focus .input,
.form *:focus .input {
  border-color: blue;
}

Other packages similar to postcss-focus-within

Keywords

FAQs

Package last updated on 23 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