FIX: Tab ordering and outlines for wizard

This commit is contained in:
Robin Ward 2016-09-22 13:38:40 -04:00
parent adfa2cb09e
commit 92529cd409
9 changed files with 18 additions and 15 deletions

View File

@ -7,7 +7,7 @@ export default Ember.Component.extend({
typeClass: type => `${Ember.String.dasherize(type)}-field`, typeClass: type => `${Ember.String.dasherize(type)}-field`,
@computed('field.id') @computed('field.id')
fieldClass: id => `field-${Ember.String.dasherize(id)}`, fieldClass: id => `field-${Ember.String.dasherize(id)} wizard-focusable`,
@computed('field.type', 'field.id') @computed('field.type', 'field.id')
inputComponentName(type, id) { inputComponentName(type, id) {

View File

@ -48,7 +48,11 @@ export default Ember.Component.extend({
keyPress(key) { keyPress(key) {
if (key.keyCode === 13) { if (key.keyCode === 13) {
this.send('nextStep'); if (this.get('showDoneButton')) {
this.send('quit');
} else {
this.send('nextStep');
}
} }
}, },
@ -63,13 +67,13 @@ export default Ember.Component.extend({
autoFocus() { autoFocus() {
Ember.run.scheduleOnce('afterRender', () => { Ember.run.scheduleOnce('afterRender', () => {
const $invalid = $('.wizard-field.invalid:eq(0) input'); const $invalid = $('.wizard-field.invalid:eq(0) .wizard-focusable');
if ($invalid.length) { if ($invalid.length) {
return $invalid.focus(); return $invalid.focus();
} }
$('input:eq(0)').focus(); $('.wizard-focusable:eq(0)').focus();
}); });
}, },

View File

@ -9,7 +9,7 @@
<div class="new-user"> <div class="new-user">
<div class="text-field {{if invalid 'invalid'}}"> <div class="text-field {{if invalid 'invalid'}}">
{{input class="invite-email" value=inviteEmail placeholder="user@example.com"}} {{input class="invite-email wizard-focusable" value=inviteEmail placeholder="user@example.com" tabindex="9"}}
</div> </div>
{{combo-box value=inviteRole content=roles nameProperty="label" width="200px"}} {{combo-box value=inviteRole content=roles nameProperty="label" width="200px"}}

View File

@ -1,5 +1,5 @@
<div class='radio-area'> <div class='radio-area'>
<input type="radio" name={{label}}> <input type="radio" name={{label}} tabindex="9">
<span class='radio-label'> <span class='radio-label'>
{{#if icon}} {{#if icon}}
{{fa-icon icon}} {{fa-icon icon}}

View File

@ -3,4 +3,5 @@
value=field.value value=field.value
content=field.choices content=field.choices
nameProperty="label" nameProperty="label"
width="400px"}} width="400px"
tabindex="9"}}

View File

@ -1 +1 @@
{{input elementId=field.id value=field.value class=fieldClass placeholder=field.placeholder}} {{input elementId=field.id value=field.value class=fieldClass placeholder=field.placeholder tabindex="9"}}

View File

@ -1 +1 @@
{{textarea elementId=field.id value=field.value class=fieldClass placeholder=field.placeholder}} {{textarea elementId=field.id value=field.value class=fieldClass placeholder=field.placeholder tabindex="9"}}

View File

@ -30,22 +30,22 @@
<div class='wizard-buttons'> <div class='wizard-buttons'>
{{#if showQuitButton}} {{#if showQuitButton}}
<a href {{action "quit"}} class='action-link quit'>{{i18n "wizard.quit"}}</a> <a href {{action "quit"}} class='action-link quit' tabindex="11">{{i18n "wizard.quit"}}</a>
{{/if}} {{/if}}
{{#if showBackButton}} {{#if showBackButton}}
<a href {{action "backStep"}} class='action-link back'>{{i18n "wizard.back"}}</a> <a href {{action "backStep"}} class='action-link back' tabindex="11">{{i18n "wizard.back"}}</a>
{{/if}} {{/if}}
{{#if showNextButton}} {{#if showNextButton}}
<button class='wizard-btn next primary' {{action "nextStep"}} disabled={{saving}}> <button class='wizard-btn next primary' {{action "nextStep"}} disabled={{saving}} tabindex="10">
{{i18n "wizard.next"}} {{i18n "wizard.next"}}
{{fa-icon "chevron-right"}} {{fa-icon "chevron-right"}}
</button> </button>
{{/if}} {{/if}}
{{#if showDoneButton}} {{#if showDoneButton}}
<button class='wizard-btn done' {{action "quit"}} disabled={{saving}}> <button class='wizard-btn done' {{action "quit"}} disabled={{saving}} tabindex="10">
{{i18n "wizard.done"}} {{i18n "wizard.done"}}
</button> </button>
{{/if}} {{/if}}

View File

@ -175,7 +175,6 @@ body.wizard {
font-size: 1.0em; font-size: 1.0em;
border: 0px; border: 0px;
padding: 0.5em; padding: 0.5em;
outline: 0;
transition: background-color .3s; transition: background-color .3s;
margin-right: 0.5em; margin-right: 0.5em;
@ -390,7 +389,6 @@ body.wizard {
padding: 6px; padding: 6px;
border: 1px solid #ccc; border: 1px solid #ccc;
transition: border-color .5s; transition: border-color .5s;
outline: none;
} }
&.invalid { &.invalid {