ve.ui.MWParameterPage: Use more natural DOM order for text field and buttons

OO.ui.BookletLayout does not respect tabindices when trying to focus
the first focusable element after a page is switched. Remove the need
for manually set tabindices in ve.ui.MWTemplateDialog by using natural
DOM order and absolutely positioning things to keep current design.

Bug: T114562
Change-Id: I7a18a455f9fa80eb3d2ea17bff8139e0194c0fbf
This commit is contained in:
Bartosz Dziewoński 2015-10-04 20:39:16 +02:00
parent 5124a7075b
commit 205beb2b49
3 changed files with 5 additions and 19 deletions

View file

@ -213,22 +213,6 @@ ve.ui.MWTemplateDialog.prototype.onAddParameter = function ( param ) {
} else {
this.onAddParameterBeforeLoad( page );
}
// Recalculate tab indexes
this.$body.find( '.ve-ui-mwParameterPage' ).each( function ( index ) {
$( this )
.find( '.ve-ui-mwParameterPage-field > .oo-ui-textInputWidget > textarea' )
.attr( 'tabindex', index * 3 + 1 )
.end()
.find( '.ve-ui-mwParameterPage-infoButton > a' )
.attr( 'tabindex', index * 3 + 2 )
.end()
.find( '.ve-ui-mwParameterPage-removeButton > a' )
.attr( 'tabindex', index * 3 + 3 )
.end()
.find( '.ve-ui-mwParameterPage-more a' )
.attr( 'tabindex', index * 3 + 4 );
} );
};
/**

View file

@ -110,7 +110,7 @@ ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, name, config )
.focus( this.onAddButtonFocus.bind( this ) );
this.$element
.addClass( 've-ui-mwParameterPage' )
.append( this.$info, this.$actions, this.$field, this.$more );
.append( this.$info, this.$field, this.$actions, this.$more );
this.$description
.addClass( 've-ui-mwParameterPage-description' )
.append( $( '<p>' ).text( this.spec.getParameterDescription( paramName ) || '' ) );

View file

@ -8,6 +8,7 @@
.ve-ui-mwParameterPage.oo-ui-pageLayout {
padding-top: 0;
padding-bottom: 0;
position: relative;
}
.ve-ui-mwParameterPage.oo-ui-pageLayout:last-of-type {
@ -29,9 +30,10 @@
}
.ve-ui-mwParameterPage-actions {
float: right;
cursor: default;
padding-right: 2.5em;
position: absolute;
top: 0;
right: 4em; /* 1.5em for PanelLayout's padding + 2.5em */
width: 20%;
text-align: right;
-webkit-box-sizing: border-box;