Skip to content

Instantly share code, notes, and snippets.

@dhindurthy
Created April 11, 2019 21:44
Show Gist options
  • Save dhindurthy/0e67e72f6ddca01b281abcc861b95dbb to your computer and use it in GitHub Desktop.
Save dhindurthy/0e67e72f6ddca01b281abcc861b95dbb to your computer and use it in GitHub Desktop.
accessible-form
import Ember from 'ember';
export default Ember.Component.extend({
tagName:'',
actions:{
focusout(){
this.focusout();
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
buttonDisabled: true,
actions:{
submitForm(){
},
focustoutUn(){
//alert('rr');
},
passwordFocusout(){
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
input {
display: block;
}
{{yield}}
<label for={{id}}>{{label}}</label>
{{input id=id type="text" value=value focusOut=(action "focusout")
ariaErrormessage="errMsg" aria-invalid=ariaInvalid}}
<p id="errMsg" aria-live="on" style="color:red;">
{{#if errorMessage}}
{{errorMessage}}
{{/if}}
</p>
{{yield}}
<h4>Formy</h4>
<fieldset>
<legend>Simple Form</legend>
<form>
<MyFormInput @label="User name"
@id="username"
@focusout={{action "focustoutUn"}}
@ariaInvalid={{ariaInvUn}}
@errorMessage={{errMsgUn}}
aria-errormessage="afd"
/>
<br>
{{!--<label for="pwd">Password</label>
{{input id="pwd" type="text" value=password focusOut=(action "passwordFocusout")
aria-errormessage="errMsgPwd" aria-invalid=ariaInvPwd}}--}}
<br>
<button type="submit" {{action "submitForm"}} disabled={{this.buttonDisabled}}>Login</button>
</form>
</fieldset>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment