Ionic change causes css to stop working - any way to modify shadow dom to fix it?

I was just looking at some of my saved code snippets and came across this snippet on how to access the Shadow DOM via JS. In this example we are editing an IonModal. I don’t recall if it worked or not as I am not currently using it (maybe found a better solution for what I was trying to do).

this.modal.shadowRoot
    ?.querySelector('slot')
    ?.assignedElements()
    .find(element => element.classList.contains('ion-page'))
    ?.classList.remove('ion-page')