Some days I'm inclined to rant about software bloat. I've often quoted or paraphrased a bit of dialogue from the Scott Meyer novel _Off to Be the Wizard_ that's kind of funny but also pretty sad: Phillip (time traveler from 1984): What on earth can a person do with 4 gigabytes of RAM? Martin (from 2012): Upgrade it immediately. But on the other hand, some of what might be perceived as bloat is really useful, even nec…
I'm convinced that's not true. Consider the case of CSS and ARIA roles. You could very easily write CSS/JS components defined on roles using CSS 2.1 attribute selectors, and accessibility just follows naturally. For instance, define your tab panels using role="tab", and screen readers should immediately understand it, while for visual designs, your CSS and JS just select on the appropriate roles. You then use classes for non-semantic content, like font and colour instead of using classes for everything as is currently standard.
So you're not duplicating code, you're writing better semantic markup once which can be properly interpreted multiple ways in different media.
Not how it's currently done, but there's no reason it can't be done that way, even for desktop UIs.