Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #251 from ckeditor/t/249
Browse files Browse the repository at this point in the history
Fix: DropdownView should open upon arrow down key press. Closes #249.
  • Loading branch information
oskarwrobel committed Jun 13, 2017
2 parents 7117dca + 9dfc076 commit c1e6afc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
30 changes: 1 addition & 29 deletions src/dropdown/dropdownview.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,6 @@ export default class DropdownView extends View {

// Toggle the visibility of the panel when the dropdown becomes open.
panelView.bind( 'isVisible' ).to( this, 'isOpen' );

/**
* The label of the dropdown.
*
* @observable
* @member {String} #label
*/

/**
* Controls whether the dropdown is enabled (can be clicked).
*
* @observable
* @member {Boolean} #isEnabled
*/

/**
* Controls whether the {@link #buttonView} is "pushed".
*
* @observable
* @member {Boolean} #isOn
*/

/**
* (Optional) Whether the label of the dropdown is visible. See {@link module:ui/button/buttonview~ButtonView#withText}.
*
* @observable
* @member {Boolean} #withText
*/
}

/**
Expand All @@ -149,7 +121,7 @@ export default class DropdownView extends View {
// Open the dropdown panel using the arrow down key, just like with return or space.
this.keystrokes.set( 'arrowdown', ( data, cancel ) => {
// Don't open if the dropdown is disabled or already open.
if ( this.isEnabled && !this.isOpen ) {
if ( this.buttonView.isEnabled && !this.isOpen ) {
this.isOpen = true;
cancel();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/dropdown/dropdownview.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe( 'DropdownView', () => {
stopPropagation: sinon.spy()
};

view.isEnabled = true;
view.buttonView.isEnabled = true;

view.isOpen = true;
view.keystrokes.press( keyEvtData );
Expand All @@ -149,7 +149,7 @@ describe( 'DropdownView', () => {
stopPropagation: sinon.spy()
};

view.isEnabled = false;
view.buttonView.isEnabled = false;
view.isOpen = false;

view.keystrokes.press( keyEvtData );
Expand Down

0 comments on commit c1e6afc

Please sign in to comment.