AUI-1648

I'm not really able to write any tests for this. The current set of tests "should" catch any issues, I assume.

This PR will definitely conflict with https://github.com/jonmak08/alloy-ui/pull/240. Let me know which one makes it in first and I'll rebase the other so it goes in cleanly.