Fixes https://github.com/Polymer/core-overlay/issues/17 and https://github.com/Polymer/core-overlay/issues/12.