File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ var CustomSelect = function(options) {
6363 selectContainer . appendChild ( ul ) ;
6464
6565 selectContainer . addEventListener ( 'click' , onClick ) ;
66+ selectContainer . addEventListener ( 'keypress' , function ( event ) {
67+ if ( event . key === 'Enter' ) {
68+ onClick ( event ) ;
69+ }
70+ } ) ;
6671
6772 // pseudo-select is ready - append it and hide the original
6873 elem . parentNode . insertBefore ( selectContainer , elem ) ;
@@ -80,6 +85,7 @@ var CustomSelect = function(options) {
8085 li . innerText = options [ i ] . textContent ;
8186 li . setAttribute ( 'data-value' , options [ i ] . value ) ;
8287 li . setAttribute ( 'data-index' , index ++ ) ;
88+ li . setAttribute ( 'tabindex' , '0' ) ;
8389
8490 if ( selectOptions [ elem . selectedIndex ] . textContent === options [ i ] . textContent ) {
8591 li . classList . add ( selectedClass ) ;
You can’t perform that action at this time.
0 commit comments