There's a law in Texas that says legislators have a duty to attend the legislature. They agreed to that when they decided to run for office. They betrayed that promise for partisan political reasons, and they are reaping the rewards. That's how it's legal. Hope that helps.