Modal data-bs-dismiss and data-bs-target
Created by: ray73864
Currently modals support a 'data-bs-target' with the 'data-bs-toggle' attribute, that way if you have a 'data-bs-toggle' of 'Modal' it knows which Modal to actually open.
I would love to see 'data-bs-dismiss' also support a 'data-bs-target' attribute if one is present.
Right now, I am free to open a modal, then while that modal is being displayed, open another one and have the new one on top, which is great for at work, in my case, modalOne is for adding a not on file part number to a customer quote, and modalTwo is for a markup calculator that modalOne can open (This is for our stores), I used to do all this using Bootbox, but since moving to BS5 for all my new stuff and completely dropping jQuery, I can't use Bootbox anymore.
The problem is that if you close modalTwo, it also closes modalOne, so what I have done is when modalTwo opens, I add a custom event to the btn-close (I removed 'data-bs-dismiss' from the button) and also overrode the 'escape' key, in both instances when you click the 'X' on modalTwo or press escape, it closes only modalTwo and takes you back to the correct field on modalOne.
If there was a 'data-bs-target' available for 'data-bs-dismiss', then I could tell it which modal it is to close.
Hopefully that all makes sense.