H4 visa and working for other country

Hello! My wife have a H4B visa, I am H1. I am working for US company, and she work for Spanish company in Spain for around 6 month, and other monthes remotely in US. Can you please help with following questions

  1. Is it legal to work for Spanish company holding H4B visa under described situation?

  2. Should she pay taxes for US?

Many thanks!

Illegal to work while on H4