FIX: Better focus support for modals (PR #13147)

GitHub

Did this cause issues on mobile?

I copied that from the old code I moved. It might not be necessary anymore but we were doing it before for a reason.