That's not always enough, sometimes you need some code simulating the "deny all" clicks or tweaking CSS class lists on the body and html elements.
Otherwise, you might end up with some unscrollable page because for instance there's a CSS rule that blocks scrolling when the modal is there and restores it when the modal closes and this handling is unfortunately done in JS.