bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

modal.dispose() does not fully clean up body element mutations

Open RyanBerliner opened this issue 2 years ago • 3 comments

Prerequisites

Describe the issue

Calling dispose() on a CLOSED modal will fully remove all events and data of the modal. This works as expected.

However, should you attempt to dispose() a modal while its OPENED, there are lingering bits of dom mutation left over. Glancing the dom and source code quickly it looks like this is mainly just a modal-open class on the body, as well as inline styling on the body.

I'm not super confident in my assumption that dispose() should be responsible for this, but given it cleans up its backdrop and focustrap on dispose, which are only ever active when its OPENED, it makes me think this is a bug that it ignores the body element. I believe dispose() should also remove the mutations it performs on the body.

I can submit a fix for this if its agreed to be a bug - let me know

Reduced test cases

https://jsfiddle.net/tnLuvz8d/

What operating system(s) are you seeing the problem on?

Windows, macOS, Android, iOS, Linux

What browser(s) are you seeing the problem on?

Chrome, Safari, Firefox, Microsoft Edge, Opera

What version of Bootstrap are you using?

5.1.3 is used in the demo - haven't checked how far back this is the case

RyanBerliner avatar Mar 02 '22 21:03 RyanBerliner