This might be rather related to this fact,
which was followed by this feedback:
The improvement that was made in that regard:
I’m just summarizing the current state, not stating that everything is 100% accurate accessibility wise.
Not claiming myself as an expert, as my knowledge is only above average, I would say.
I still would prefer that the modal content is not accessible when the modal is not active, but that would speak against what Louis said above.
Also, I’m not a big fan of manipulating the DOM after page load, as the user has no control about it:
Placing modals in that exact spot is achievable by using global parts and building templates with Fragments, so I prefer to do it by myself if required.
Nothing against the current default behaviour though, as it’s helpful for vast majority of the users, I guess.