-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Why is it that material-ui calls their dialogs twice? #24641
Comments
These two demos have |
Ok good to know that the behaviour is correct. This causes accessibility problems for our implementation of the MUI modals though, because the duplicate code causes |
Solved. Before ...
const HtmlWebpackPlugin = require("html-webpack-plugin");
let config = {
optimization: {},
plugins: [
new webpack.EnvironmentPlugin(['ENV_VAR']),
new HtmlWebpackPlugin({
template: "./public/index.html"
}),
new webpack.HotModuleReplacementPlugin()
],
... After ...
let config = {
optimization: {},
plugins: [
new webpack.EnvironmentPlugin(['ENV_VAR']),
],
... It seems that the html would be loaded twice (?) and thus the modal would trigger twice as well. |
i got the same problem, a workaround i came up with was to set the visibility of the second occurrence to hidden
|
Current Behavior 😯
I tried to set a modal first and I noticed that behaviour, then I changed it for a dialog and it is the same.
I tried this:
I call it in the app.tsx:
<MyDialog />
And when I call the function to show the dialog, it shows twice in the DOM, what makes me curious is that one of them has the
aria-hidden=true
attribute.But they have the exact same content inside if I inspect them.
I noticed something similar in the docs page https://material-ui.com/components/dialogs/, if you inspect the DOM, there is always one dialog but the difference is that it has
visibility: hidden
.Any ideas about this?
Expected Behavior 🤔
Not showing repeated componentes in the DOM even if they are not present in the UI.
Steps to Reproduce 🕹
The issue is present in your docs: https://material-ui.com/components/dialogs/
Steps:
Context 🔦
I am trying to avoid not having duplicate components I don't need in the DOM.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: