Fixes #1510. Fixes #1556. This depends on PR #1771 and #1773.
I open this as a "draft" PR because it has PR #1773 as its base branch, to isolate the diff to the changes unique to this PR. I will re-target this PR to the main branch before merging.
Preview | Diff