Last active
April 6, 2018 23:32
-
-
Save dhindurthy/79eea3a0cddaa95da7f579e9d4a584b1 to your computer and use it in GitHub Desktop.
modal-accessible
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames:['cx-modal'], | |
attributeBindings: ['tabindex:tabindex','role:role'], | |
role:'dialog', | |
tabindex:0, | |
didRender(){ | |
this.$().children().first().focus(); | |
}, | |
keyDown: function(event){ | |
if(event.keyCode===9 ){ | |
var nextElement =this.$(document.activeElement).next().length; | |
if(!event.shiftKey && nextElement===0){ | |
event.preventDefault(); | |
this.$().children().first().focus(); | |
} | |
var prevElement =this.$(document.activeElement).prev().length; | |
if(event.shiftKey && prevElement===0){ | |
event.preventDefault(); | |
this.$().children().last().focus(); | |
} | |
} | |
if(event.keyCode===27 ){ | |
this.sendAction('closeModal'); | |
} | |
}, | |
focusOut(event){}, | |
didDestroyElement(){ | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
isModalVisible: false, | |
actions:{ | |
toggleModal:function(){ | |
this.set('isModalVisible', true); | |
}, | |
closeModal: function(){ | |
this.set('isModalVisible', false); | |
} | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.cx-modal{ | |
border: 5px solid #E35B44; | |
padding:20px; | |
margin:10px; | |
width:75%; | |
position: absolute; | |
z-index: 1; | |
background-color:white; | |
} | |
.note { | |
color:#E35B44; | |
} |
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
{ | |
"version": "0.13.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment