Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete loses navigation keybindings after switching source mode #3938

Closed
jacekbogdanski opened this issue Mar 18, 2020 · 2 comments
Closed
Assignees
Labels
plugin:autocomplete The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@jacekbogdanski
Copy link
Member

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open any sample with autocomplete and sourcearea plugins.
  2. Switch between source editing and content editing.
  3. Trigger autocompletion.
  4. Navigate using arrow keys.

Expected result

You can navigate through the completion panel using a keyboard.

Actual result

Keybindings are removed.

Other details

Probably standard issue with incorrect event listener on editable where we should use attachListener instead:

this._listeners.push( editable.on( 'keydown', function( evt ) {
this.onKeyDown( evt );
}, this, null, 5 ) );

@jacekbogdanski jacekbogdanski added type:bug A bug. status:confirmed An issue confirmed by the development team. plugin:autocomplete The plugin which probably causes the issue. workload:low labels Mar 18, 2020
@f1ames
Copy link
Contributor

f1ames commented Mar 18, 2020

The correct way is to attach key listeners inside contentDom event listener, same as e.g. here:

editor.on( 'contentDom', function() {
var editable = editor.editable();
if ( !editable ) {
return;
}
editable.attachListener( editable, 'keydown', function( evt ) {
this._.shiftPressed = evt.data.$.shiftKey;
}, this );
editable.attachListener( editable, 'keyup', function( evt ) {
this._.shiftPressed = evt.data.$.shiftKey;
}, this );
} );

@f1ames
Copy link
Contributor

f1ames commented Apr 1, 2020

Fixed in f0dfded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin:autocomplete The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

2 participants