-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clicking rapidly does not automatically closes the modal
If a user double clicks to open the modal, the second click gets otherwise captured by the overlay and the modal gets closed even before being visible to the user.
- Loading branch information
Showing
12 changed files
with
106 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Component from '@ember/component'; | ||
import { action } from '@ember/object'; | ||
import { tagName, layout as templateLayout } from '@ember-decorators/component'; | ||
import { isIOS, clickHandlerDelay } from '../utils/config-utils'; | ||
import layout from '../templates/components/overlay'; | ||
|
||
@tagName('') | ||
@templateLayout(layout) | ||
export default class OverlayComponent extends Component { | ||
@action | ||
_onClickOverlay(event) { | ||
let { onClickOverlay } = this; | ||
if (onClickOverlay) { | ||
onClickOverlay(event); | ||
} | ||
} | ||
|
||
@action | ||
didInsert(element) { | ||
const registerClick = () => { | ||
element.addEventListener('click', this._onClickOverlay); | ||
}; | ||
|
||
// setTimeout needed or else the click handler will catch the click that spawned this modal dialog | ||
setTimeout(registerClick, clickHandlerDelay(this)); | ||
|
||
if (isIOS) { | ||
element.style.cursor = 'pointer'; | ||
} | ||
} | ||
|
||
@action | ||
willDestroyNode(element) { | ||
element.removeEventListener('click', this._onClickOverlay); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div | ||
class="emd-debug" | ||
tabindex='-1' | ||
data-emd-overlay | ||
{{did-insert this.didInsert}} | ||
{{will-destroy this.willDestroyNode}} | ||
...attributes | ||
> | ||
{{yield}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-modal-dialog/components/overlay'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters