Closed kbwatts closed 9 years ago
Perhaps this is done intentionally, and dialogs should not have complex behaviour or require any more user interaction than the buttons.
If this is the case, disregard this one...
The only workaround I've seen for this is to put the style reference inside the tag, like this:
<polymer-element name="myelement">
<template>
<paper-action-dialog heading="mydialog">
<link rel="stylesheet" href="whatever.css" />
</paper-action-dialog>
</template>
</polymer-element>
Nice idea, that, at least, gets away from inline styling.
Have you found a similar workaround for getting js to affect elements within the dialog?
e.g.
<link rel="import" href="whatever.html" />
Where the imported whatever.html
contains relevant js? (e.g. what if the user needs to clear the input within the dialog after submitting?)
Or <script src="path/to/whatever.js"></script>
within the template...
This is due to the way the content in a core-overlay, which paper-dialog extends, is inserted into a shadow DOM. To pierce the shadow DOM you need to prepend html /deep/
to your selector:
html /deep/ paper-checkbox::shadow #ink { color: #007e9e; }
Good idea - I started doing that after re-reading http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/ and it seems to work :+1:
It seems difficult to apply css to elements within paper-dialogs other than using inline styling because of the way core-overlay handles the dialogs and seems to remove them from the DOM entirely when not displayed.
For example,
paper-input
andpaper-checkbox
should have the same colors across the application, so they should pick up the style for something like:paper-checkbox::shadow #ink { color: #007e9e; }
But this (anything similar) seems not to affect
paper-checkbox
withinpaper-dialog
despite correctly styling other non-paper-dialog
instances ofpaper-checkbox
. Am I doing something wrong, or is this intentional, or something else altogether?Here's an example of a paper-dialog I'm using to ask for user feedback: