mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 01:22:36 +08:00
FIX: Tab ordering and outlines for wizard
This commit is contained in:
parent
adfa2cb09e
commit
92529cd409
|
@ -7,7 +7,7 @@ export default Ember.Component.extend({
|
|||
typeClass: type => `${Ember.String.dasherize(type)}-field`,
|
||||
|
||||
@computed('field.id')
|
||||
fieldClass: id => `field-${Ember.String.dasherize(id)}`,
|
||||
fieldClass: id => `field-${Ember.String.dasherize(id)} wizard-focusable`,
|
||||
|
||||
@computed('field.type', 'field.id')
|
||||
inputComponentName(type, id) {
|
||||
|
|
|
@ -48,7 +48,11 @@ export default Ember.Component.extend({
|
|||
|
||||
keyPress(key) {
|
||||
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() {
|
||||
Ember.run.scheduleOnce('afterRender', () => {
|
||||
const $invalid = $('.wizard-field.invalid:eq(0) input');
|
||||
const $invalid = $('.wizard-field.invalid:eq(0) .wizard-focusable');
|
||||
|
||||
if ($invalid.length) {
|
||||
return $invalid.focus();
|
||||
}
|
||||
|
||||
$('input:eq(0)').focus();
|
||||
$('.wizard-focusable:eq(0)').focus();
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<div class="new-user">
|
||||
<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>
|
||||
|
||||
{{combo-box value=inviteRole content=roles nameProperty="label" width="200px"}}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class='radio-area'>
|
||||
<input type="radio" name={{label}}>
|
||||
<input type="radio" name={{label}} tabindex="9">
|
||||
<span class='radio-label'>
|
||||
{{#if icon}}
|
||||
{{fa-icon icon}}
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
value=field.value
|
||||
content=field.choices
|
||||
nameProperty="label"
|
||||
width="400px"}}
|
||||
width="400px"
|
||||
tabindex="9"}}
|
||||
|
|
|
@ -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"}}
|
||||
|
|
|
@ -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"}}
|
||||
|
|
|
@ -30,22 +30,22 @@
|
|||
|
||||
<div class='wizard-buttons'>
|
||||
{{#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 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 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"}}
|
||||
{{fa-icon "chevron-right"}}
|
||||
</button>
|
||||
{{/if}}
|
||||
|
||||
{{#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"}}
|
||||
</button>
|
||||
{{/if}}
|
||||
|
|
|
@ -175,7 +175,6 @@ body.wizard {
|
|||
font-size: 1.0em;
|
||||
border: 0px;
|
||||
padding: 0.5em;
|
||||
outline: 0;
|
||||
transition: background-color .3s;
|
||||
margin-right: 0.5em;
|
||||
|
||||
|
@ -390,7 +389,6 @@ body.wizard {
|
|||
padding: 6px;
|
||||
border: 1px solid #ccc;
|
||||
transition: border-color .5s;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.invalid {
|
||||
|
|
Loading…
Reference in New Issue
Block a user