bem-components icon indicating copy to clipboard operation
bem-components copied to clipboard

Theme as a modifier results in the need to increase specificity

Open tadatuta opened this issue 11 years ago • 6 comments
trafficstars

Continuing the conversation with @veged, I want to discuss the issue with theme as a modifier.

Here are cases:

  1. To make some block invisible with modifier or mix, user should often use mustDeps on lib's theme or somehow increase specificity as there are display properties in _theme_islands (e.g. https://github.com/bem/bem-components/blob/v2/design/common.blocks/button/_theme/button_theme_islands.styl#L7).
  2. The same issue appear when user wants to create layout with the help of mixes with some layout block as such properties as margin and padding are set as well (https://github.com/bem/bem-components/blob/v2/design/common.blocks/button/_theme/button_theme_islands.styl#L9-L10).

Maybe someone will find the way to make it better?

tadatuta avatar Nov 01 '14 18:11 tadatuta

// cc @mishanga

tadatuta avatar Nov 12 '14 14:11 tadatuta

need more real life examples

veged avatar Feb 17 '15 15:02 veged

@tadatuta still waiting to usecases

aristov avatar Apr 02 '15 14:04 aristov

@narqo you said you have something

aristov avatar Apr 02 '15 14:04 aristov

@tadatuta @narqo ping

deeonis avatar May 21 '15 11:05 deeonis

The common usecase which hurts:

{ block : 'button',
  mods : { theme : 'islands', size : 'm' },
  mix : { block: 'head-toolbar', elem : 'action' },
  text : 'New message' }

As @tadatuta has already noticed, you can't add margin style to .head-toolbar__action, without adding mustDeps dependency from button_theme_islands.

The same things happen if try to mix something to elements (or nested blocks) of islands themed blocks, like menu > menu-item or menu-item_type_link > link

narqo avatar May 22 '15 19:05 narqo