Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot set modal backdrop root element #34309

Open
eladmarg opened this issue Jun 20, 2021 · 5 comments
Open

cannot set modal backdrop root element #34309

eladmarg opened this issue Jun 20, 2021 · 5 comments

Comments

@eladmarg
Copy link

after modal backdrop change, it's always appended to the body.

there is a constructor to change the default, but it always taking default values for visible and animated properties.
return new Backdrop({
isVisible: Boolean(this._config.backdrop),
isAnimated: this._isAnimated(),
});

so even if this._config contains other parameters, they're not passed to the ctor.
this can be extended with ... or get other properties as well.

@GeoSot
Copy link
Member

GeoSot commented Jun 20, 2021

Hello @eladmarg

Please if you want an answer, try to be more specific , and add some code snippet and examples.

What was the behavior before and after the change, what are the expectations and for what reason

@eladmarg
Copy link
Author

Hi @GeoSot ,
thanks for your fast reply,

if I would like to create the modal-backdrop div, not inside the body, I have no way to do it in the current version.

in the _initializeBackDrop() function
the constructor to new Backdrop takes only 2 parameters

 return new Backdrop({
        isVisible: Boolean(this._config.backdrop),
        isAnimated: this._isAnimated(),
      });

so there is no option to override the rootElement
a solution can be to take the other parameters as well from the configuration
for instance:

_initializeBackDrop() {
      return new Backdrop({
        isVisible: Boolean(this._config.backdrop),
        isAnimated: this._isAnimated(),
        rootElement: this._config.rootElement
      });
    }

@GeoSot
Copy link
Member

GeoSot commented Jun 21, 2021

after modal backdrop change, it's always appended to the body.

So my real question is:

"Does the modal had a different attitude before backdrop change, that got ruined or you would to have this option as feature?"


The initial message indicates that we broke this functionality, but my searches on the previous changes doesn't seem to agree
#32439 Line:339 😕

In case of miswrote , please help us by fixing your initial message .

There are some MRs and Feature Requests open but stale about this feature, that's why I left an entry point (the option), during the implementation.
If you are also comfortable, we would really appreciate any new MR, otherwise we will put it on our plans for a next release

#33018, #33574 etc

@eladmarg
Copy link
Author

yes,
for some reason, after upgrading from v5 beta 3 to 5.01 it stopped working on my custom spa framework (which only changes the body content by ajax requests)

i managed to solve this by modifying the dist version, but I think it's better to have the ability to set the backdrop container on data-bs-root-element="#backdrop" for instance

yes, #33018 might solve this but it's not ready for pr.

@GeoSot GeoSot added the feature label Jun 21, 2021
@GeoSot
Copy link
Member

GeoSot commented Jun 21, 2021

So you are really welcome to create a new one :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants