-
Notifications
You must be signed in to change notification settings - Fork 660
Model paper-dialog not working correctly within a polymer-starter-kit app #154
Comments
Hi @rbjarnason I have this button to open the paper-dialog:
This is my "feedback" function in the element: (note: the paper-dialog is in the same element)
The feedback function opens the "setDialog" function:
This function is adding the whole paper-dialog to the body-element. Then you can use the paper-dialog as normal. Every time the paper-dialog should close, you have to call "this.setDialog(false);". Then the paper-dialog will switch back to his old position in the dom. The error occours, because the "iron-overlay-backdrop"-element - for modal paper-dialogs - is always added to the body-element and overlaps the paper-dialog. I hope I can help you! |
Thanks for posting the workaround @Alienuser.
Is this a bug with |
@Alienuser Thanks! I can now use the workaround until a fix is in place :) |
I don't think this is a bug with iron-overlay-backdrop because the paper-dialog works well if I add it in the index.html. But I think it would be nice if the iron-overlay-backdrop will add itself in the same node as the paper-dialog. Therefore I think its a feature request? :) |
Hi, same issue here. |
I noticed this as well. Echoing @Alienuser's feedback. I added By the way, @Alienuser, is your workaround implemented within the Polymer element? Still nascent to Polymer so I apologize! |
@Alienuser have same issue. I've followed your instructions: created button which calls feedback button on click and added feedback and setDialog functions to file paper-dialog.html, but nothing gonna happens when I press the button. I am totally beginner, and I really don't know what's the problem. Please, can you explain as detail as you can to help me? |
Is this paper-dialog modal which has been questioned for? i used
Reference from F12 Dev-Tools https://elements.polymer-project.org/elements/paper-dialog?view=demo:demo/index.html I'll try again put into template and improve again if possible. |
@rbjarnason Still an issue? |
Closing but happy to reopen if others are running into this |
Bump. Same Issue here. I am using polymer starter kit and opening paper dialog as "modal" makes the overlay cover the whole page even the dialog. Using the fix for now. Thanks @Alienuser |
@Skmsoumya any way you could push a test case for us? |
Perhaps it's connected to this: PolymerElements/paper-dialog#79 |
I have the same issue as well. I created a custom element which contains an icon button and a dialog, and it's used within a toolbar. Backdrop covers the dialog:( |
Can we just modify paper-dialog-behavior.html to call the following? This works for me. If this direction is acceptable to the devs, I'm happy to submit a patch. attached: function() {
if (this.keepWithParent !== true) {
document.querySelector('body').appendChild(this);
}
} |
@polymerteam Sorry for the getting so late. A peculiar thing that I found out is that sometimes the dialog works sometimes it doesn't. I downloaded a fresh Polymer Starter kit and did what I was doing with my production site. It worked there. |
Fixes PolymerElements/paper-dialog#7 Fixes Polymer/polymer-starter-kit#154 Fixes (maybe) PolymerElements/paper-dialog#79 Fixes (maybe) PolymerElements/paper-dialog#44 Fixes (maybe) PolymerElements/paper-drawer-panel#122 Related to PolymerElements#72 Related to PolymerElements#86 Related to https://github.com/PolymerElements/iron-overlay-behavior/compare/backdrop-refit Fixes (maybe) PolymerElements/paper-dialog-behavior#78 Fixes PolymerElements/app-layout#155
+1 |
1 similar comment
+1 |
+1 Great! |
@Alienuser hi, very interesting, I use your solution and works perfect on Chrome but aparently doesnt work on explorer or firefox :( |
@valdrinkoshi is the recommended fix the one advised here PolymerElements/paper-dialog#7 (comment) ? |
Hi @robdodson, yes overlays should be appended in a node that is in the same stacking context as document.body.
|
Hi, thanks for your comments, but I am just a rookie with polymer and maybe my english is not the best :D , thats why even with your answer I am not sure about how to deal with this problem or how to implement it yet :(, but thanks for your time I am going to try. |
Does it work when you run gulp serve:dist? Any console errors when you open On Jul 23, 2016 7:47 AM, "Chad Baxter" [email protected] wrote:
|
OK so the solution to this problem is to put any paper-dialog elements inside of As Valdrin mentioned, there is also work going on to improve the way dialogs work. Honestly, it feels like we're missing some crucial platform primitives and I tried to write about them here: https://robdodson.me/building-better-accessibility-primitives/ Closing this issue as the fix is to put paper-dialog directly inside of body. |
Another approach that I think may also work if you're using the PSK layout. Add your paper-dialog to my-app.html after your drawer layout Add a listener for an event to open a dialog. This event will be dispatched by one of your views In your view, add a button to open a dialog When the user clicks the button, dispatch the event which will get picked up by the listener in my-app.html |
Sorry for diving back into a closed topic. So for the approach you listed @robdodson, how would one handle all app instances of modals (ie 15+). Would you just list them all there? Or is this of the assumption you would append all the different types of content to that one dialog instance? Cheers. |
@valdrinkoshi do you have any thoughts on how to handle a bunch of modals in an app? I think I might just see if I could have 1 modal and swap out the content inside of it based on the route somehow |
@robdodson In order to cleanly handle many modals, would it be possible to use an Let's say we have two paper-dialogs in my-app.html named dialog1 and dialog2: <paper-dialog id="dialog1" modal>
<h2>Dialog 1</h2>
<div class="buttons">
<button dialog-confirm autofocus>Accept</button>
</div>
</paper-dialog>
<paper-dialog id="dialog2" modal>
<h2>Dialog 2</h2>
<div class="buttons">
<button dialog-confirm autofocus>Accept</button>
</div>
</paper-dialog> In my-view1.html we have two buttons with corresponding <button on-tap="open" id="dialog1">Open dialog 1</button>
<button on-tap="open" id="dialog2">Open dialog 2</button> Shadow/Shady/Local/Polymer/WTF DOM should enable us to re-use The open function in my-view.html: open: function(e) {
this.fire('open-dialog');
} The event listener in my-app.html: listeners: {
'open-dialog': 'handleOpenDialog'
}, I've tried the following but not been successful in catching the handleOpenDialog: function(e) {
console.info(e.target.id + ' was clicked.'); // was clicked
console.info(Polymer.dom(e).localTarget.id + ' was clicked.'); // was clicked
console.info(Polymer.dom(e).path[1].getAttribute('id') + ' was clicked.'); // null was clicked
console.info(Polymer.dom(e).rootTarget.getAttribute('id') + ' was clicked.'); // null was clicked
console.info(e.model.get('id') + ' was clicked.'); // cannot read property 'get' of undefined
// this.$.dialog.open();
} What is the proper way of getting the value of the Aslo, if you don't see this approach working, could you please give some advice on how to proceed? |
@ketile you'd need to look for the id of the button in your open function and pass that with the event.
That could work fine on a small site. On a much larger site you might prefer to set the |
@robdodson Thanks. What would be the syntax for receiving this argument in the event listener and the handleOpenDialog function? Can't find the answer in the documentation. |
|
Included error message in custom div -> hidden by default, shown when needed. defaulted to this method, after trying toasts and paper dialogs: --- Tried using toasts - couldn't get them to effectively appear where I wanted. --- Tried using paper-dialog, but they need to go up near the <body> tag, otherwise their overlay appears over the dialog (many github issues, eg: Polymer/polymer-starter-kit#154)
I have a component that uses paper-dialog to display errors. When I added it to a simple polymer-starter-kit app the modal dialog overlay is also covering the dialog box itself and it is not possible to press the OK button as the overlay is covering it - you can still press return and escape to dismiss the paper-dialog. Strange thing is that z-index looks ok when you debug it in Chrome but still the overlay is on top of the dialog. This does not happen when using exactly the same component code directly outside the polymer-starter-kit.
The text was updated successfully, but these errors were encountered: