Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

On Mobile Safari, "with-backdrop" prevents canceling by clicking outside dialog #62

Closed
hadfieldn opened this issue Jul 14, 2015 · 4 comments

Comments

@hadfieldn
Copy link

On Mobile Safari, the following dialog doesn't close when clicking outside it:

<paper-dialog id="dialog" with-backdrop>
  <h2>Dialog Content</h2>
</paper-dialog>
@hadfieldn
Copy link
Author

As a workaround, when the dialog is opened I'm adding a listener to backdropElement to close it:

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
<dom-module id="dialog-test">
  <template>
    <paper-dialog id="dialog" with-backdrop>
      <h2>Dialog Content</h2>
    </paper-dialog>
  </template>
</dom-module>
<script>
  Polymer({
    is: 'dialog-test',

    properties: {
      _boundOnBackdropClick: {
        type: Function,
        value: function() {
          return this._onBackdropClick.bind(this);
        }
      }
    },
    open: function () {
      this.$.dialog.backdropElement.addEventListener('click', this._boundOnBackdropClick);
      this.$.dialog.open();
    },

    _onBackdropClick: function() {
      this.$.dialog.backdropElement.removeEventListener('click', this);
      this.$.dialog.close();
    }
  });
</script>

@spirylics
Copy link

+1

1 similar comment
@Anthony2539
Copy link

+1

@addyosmani
Copy link
Contributor

This issue was moved to PolymerElements/paper-dialog#33

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

No branches or pull requests

4 participants