Socket
Socket
Sign inDemoInstall

postcss-focus-within

Package Overview
Dependencies
Maintainers
2
Versions
18
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


Version published
Weekly downloads
5.4M
decreased by-2.44%
Maintainers
2
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 08 Feb 2023

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