TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/187655

Change subject: SelectWidget: listbox wrapper role, state on contents
......................................................................

SelectWidget: listbox wrapper role, state on contents

SelectWidgets contains OptionWidgets with the role option, as such the
wrapper should sport the role of listbox. The individual options
should also reflect their state, so that the listbox knows which of
the options is the currently selected one.

Bug: T88091
Change-Id: I5de49b3aca6c874e30213d2f6bb7c8ca7bbf1e09
---
M src/widgets/OptionWidget.js
M src/widgets/SelectWidget.js
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/55/187655/1

diff --git a/src/widgets/OptionWidget.js b/src/widgets/OptionWidget.js
index 9f08fd0..b4bed0a 100644
--- a/src/widgets/OptionWidget.js
+++ b/src/widgets/OptionWidget.js
@@ -116,7 +116,8 @@
 OO.ui.OptionWidget.prototype.setSelected = function ( state ) {
        if ( this.constructor.static.selectable ) {
                this.selected = !!state;
-               this.$element.toggleClass( 'oo-ui-optionWidget-selected', state 
);
+               this.$element.toggleClass( 'oo-ui-optionWidget-selected', state 
)
+                       .attr( 'aria-selected', state.toString() );
                if ( state && this.constructor.static.scrollIntoViewOnSelect ) {
                        this.scrollElementIntoView();
                }
diff --git a/src/widgets/SelectWidget.js b/src/widgets/SelectWidget.js
index 7a79a65..97c8747 100644
--- a/src/widgets/SelectWidget.js
+++ b/src/widgets/SelectWidget.js
@@ -38,7 +38,8 @@
        } );
 
        // Initialization
-       this.$element.addClass( 'oo-ui-selectWidget 
oo-ui-selectWidget-depressed' );
+       this.$element.addClass( 'oo-ui-selectWidget 
oo-ui-selectWidget-depressed' )
+               .attr( 'role', 'listbox' );
        if ( $.isArray( config.items ) ) {
                this.addItems( config.items );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/187655
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5de49b3aca6c874e30213d2f6bb7c8ca7bbf1e09
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to