How to change a child unit when you hover over a block parent in BEM?

There is a block block. In the block there is a button - also a separate block button. How in Bamu to change the state of the button when you hover on the parent unit block? .block:hover .button is not correct. To expose the class to the button when you hover over the parent with js?
March 23rd 20 at 18:41
1 answer
March 23rd 20 at 18:43
Solution
for example:

<div class="block">
 <div class="block__button button"></div>
</div>

.block:hover .block__button {...}
But it is not right to change the interior styling of the block from another block. From the parent unit I maximum width and padding set. I was just thinking that it's not right. - Jesus62 commented on March 23rd 20 at 18:46
Not quite right. More precisely, it is the best way. We just need to be sure that the specificity of a mutable property .block:hover .block__button higher than .button. - ewell commented on March 23rd 20 at 18:49
@ewell, It is in any case will be higher. Well. Thanks for the reply. - Jesus62 commented on March 23rd 20 at 18:52
@Jesus62, but where is the block changing? there is an element of change. - Rhianna66 commented on March 23rd 20 at 18:55
@Rhianna66, button is the block. Which is an element also, but it is also a separate unit. That's the problem. - Jesus62 commented on March 23rd 20 at 18:58
@Jesus62, no. you change the element .block__button. and since .button mixed with this element, these changes will apply to him (that we seek). the criminal in this is nothing. - Rhianna66 commented on March 23rd 20 at 19:01
@Jesus62,

.button {
 color: #123 !important;
}

.block:hover .block__button {
 color: #456; /* will have no effect */
}
- ewell commented on March 23rd 20 at 19:04
@ewell, I forgot what it is !important... :) - Jesus62 commented on March 23rd 20 at 19:07
@Rhianna66, And thank you. - Jesus62 commented on March 23rd 20 at 19:10

Find more questions by tags BEM