-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixed: Holding and releasing mouse button is not inserting autocomplete item #2173
Conversation
I'm thinking if we should treat this as feature instead of just fix. |
I will rebase it once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using [tabindex]
introduces several quirks.
The most visible of them is default styling for focusable elements, which appears after any mouse related action (e.g. right click and closing native context menu):
The second quirk is connected with the fact that focusing any element with mouse breaks keyboard behaviour. Tab no longer inserts selected item into the editor, but focus the next element in tab order (in the manual test case – sidebar close button), arrow keys scroll the page and Esc does nothing.
plugins/autocomplete/plugin.js
Outdated
@@ -586,7 +587,7 @@ | |||
* @readonly | |||
* @property {CKEDITOR.template} | |||
*/ | |||
this.itemTemplate = new CKEDITOR.template( '<li data-id="{id}">{name}</li>' ); | |||
this.itemTemplate = new CKEDITOR.template( '<li data-id="{id}" tabindex="-1">{name}</li>' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather add [tabindex]
programatically, via element.$.tabIndex = -1
in addItem
method. Requiring user to remember to add this attribute to itemTemplate
seems unnecessary.
After reconsidering this issue I decided to drop changes. I didn't delete commits, so it can be reverted. For proper usage of autocomplete editor should remain focused all the time, so we can continue typing. Hence it shouldn't register anything in Now fix contain less code, quirks described above don't happen, and also this change solves #2126. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What is the purpose of this pull request?
Bug fix
Does your PR contain necessary tests?
All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
What changes did you make?
I've registered autocomplete items in focusManager, so focusing them wont trigger editor blur event which was cause for hiding dropdown. Note
tabindex
is required for items to be focusable.Closes #2107.