Skip to content

fix(bem): resolve adjacent-compounds deprecation warnings#582

Merged
simeonoff merged 2 commits into
masterfrom
simeonoff/build/deprecation-warnings
Jun 11, 2026
Merged

fix(bem): resolve adjacent-compounds deprecation warnings#582
simeonoff merged 2 commits into
masterfrom
simeonoff/build/deprecation-warnings

Conversation

@simeonoff

Copy link
Copy Markdown
Contributor

Closes #581

The bem-elem mixin was generating invalid adjacent compound selectors (e.g. [aria-selected=false]__content-wrapper) when called inside an attribute selector block.

Root cause: bem--extract-block and the $nested flag had no awareness of [...] attribute selectors — both treated them as plain block context, causing the element separator __ to be appended directly onto the attribute selector.

Changes:

  • Add bem--contains-attr() — detects [ in a selector string
  • Update bem--extract-block — strips [...] (and any preceding descendant-combinator space) to return the bare block name
  • Update bem--extract-first-selector — treats a space before [ as a descendant combinator, keeping the full selector intact as $first
  • Update $nested in bem-elem — attribute selector contexts are now correctly treated as nested, producing block[attr] block__elem (compound) and block [attr] block__elem (descendant)
  • Add 4 spec cases covering both forms and their modifier variants

The easiest way to test the fixes in this PR is to install the package in the scoped-styles branch in Ignite UI for Angular.

@adrianptrv adrianptrv added ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification labels Jun 11, 2026
@simeonoff simeonoff added this pull request to the merge queue Jun 11, 2026
Merged via the queue into master with commit 88ea6ce Jun 11, 2026
4 checks passed
@simeonoff simeonoff deleted the simeonoff/build/deprecation-warnings branch June 11, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bem build ✅ status: verified Applies to PRs that have passed manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sass: Adjacent Compounds warning during compilation

2 participants