components icon indicating copy to clipboard operation
components copied to clipboard

bug(menu, drag and drop): host-context does not work on menu or drag and drop components

Open dylanreid7 opened this issue 3 years ago • 0 comments
trafficstars

Is this a regression?

  • [ ] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using :host-context() with a menu or drag and drop component item, the styling is not applied.

Reproduction

Steps to reproduce:

  1. Place a class called "parent-class" on a parent div
  2. Place a class on the specific item that should be styled (when an ancestor component has the selector of .parent-class)
  3. Apply :host-context(.parent-class) { .item-class { // some styling } }

See stackblitz for menu component: https://stackblitz.com/edit/angular-shpfzq?file=src/app/menu-overview-example.scss

See stackblitz for drag and drop component: https://stackblitz.com/edit/angular-vwsq5v?file=src/app/cdk-drag-drop-connected-sorting-group-example.css

Expected Behavior

Styling should be applied when using :host-context() with an ancestor element's selector.

Actual Behavior

Styling is not applied to menu or drag and drop component items when using :host-context() with an ancestor element's selector.

Environment

  • Angular: 14.0.0
  • CDK/Material: 14.2.5
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

dylanreid7 avatar Oct 14 '22 17:10 dylanreid7