Hi,

i use Aloha editor in Commons. When i open a Node(any content with a comment field) the cursor jumps automatically to comment. By a long Body field its a big problem, cause the user have to scroll up.

Thanks for the help.

CommentFileSizeAuthor
#5 1809620-5.patch1.12 KBWim Leers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Title: Cursor jumps to comment on opening a Node » Browser scrolls to first Aloha Editor instance
Version: 7.x-2.x-dev » 8.x-2.x-dev
Component: User interface » Aloha Editor (upstream)
Assigned: Unassigned » Wim Leers
Priority: Normal » Major

Thanks for your feedback! :)

This is work-around for an AE bug. I can only get the AE UI to become visible at all when the corresponding editable is *active*. And it only becomes active by giving it focus.
See http://drupalcode.org/project/aloha.git/blob/90dca286131a31e3231b913bd3d....

Once #1789240: Ensure Aloha Editor UI can be *always* present, not only when actively editing ("static toolbar", prevents flashing) is solved, we won't need to "activate" it anymore, and then we won't have this problem anymore.

Not marking this as a duplicate though because I'm sure others will report this as well :)

Laz5530’s picture

Thank you for the answere.

I think i have a solution to evade this "jumping".

I have outcommented the line: Aloha.jQuery('#' + id).focus().trigger('mousedown').trigger('mouseup');
So now the Aloha-Editor-Line appears just if i click on the text Field, but it doesnt jump.
I think this is how it should work, because if i want to edit something, then i will click there for sure :)

Now it looks like:
...
Aloha.getEditableById(id).activate();
// This hack will trigger the floating menu to appear *immediately*.
//Aloha.jQuery('#' + id).focus().trigger('mousedown').trigger('mouseup');
},
...

quicksketch’s picture

I also agree that we should remove this hack that gives the first editor focus. I understand the reason for making the toolbar visible on the first editor, but the hack to make it appear is worse than the original problem of it not being visible.

Wim Leers’s picture

Fair enough :) Will fix this tomorrow.

Wim Leers’s picture

Component: Aloha Editor (upstream) » Code
Status: Active » Reviewed & tested by the community
FileSize
1.12 KB

Attached patch fixes it.

Wim Leers’s picture

Version: 8.x-2.x-dev » 7.x-2.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

The first change in the patch prevents Aloha from working well in Edit. It's something that will be fixed by #1789240: Ensure Aloha Editor UI can be *always* present, not only when actively editing ("static toolbar", prevents flashing).

I kept the second change, which is the *actual* fix for this problem anyway.

http://drupalcode.org/project/aloha.git/commit/634432c