Ticket #154 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Editing focus shouldn't be lost when clicking formatting buttons

Reported by: weswinham Owned by: weswinham
Priority: major Milestone: 0.5
Component: editor Version: trunk
Keywords: Cc:

Description

Currently, when a user is editing text and they need to change formatting (indent a list, make something bold, make something a heading etc), they have to click the button and then click back in to the editor. This is tedious as it basically doubles the amount of clicks needed to perform an action, and it results in a kind of bubbling up of frustration in using the editor versus MS Word or TinyMCE (which is unfortunate, because WYMeditor is a much better editor when accessibility is a concern imo).

When clicking a button, container or class, the focus should automatically return to the editing frame so that the user can continue typing.

Attachments

154_patch.diff Download (1.6 KB) - added by weswinham 3 years ago.

Change History

Changed 3 years ago by weswinham

comment:1 Changed 3 years ago by weswinham

I've attached a patch that implements this. Basically, I'm just calling focus on the editor iframe in the click handler for container buttons, tool buttons and class buttons.

comment:2 Changed 3 years ago by jf.hovinne

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r617, thanks for the patch.

comment:3 Changed 3 years ago by weswinham

Thanks for patching this. I'm sorry to say though that I think the patch I had up might be slightly defective. I had initially ran with that patch for a while and it works great on firefox and ie in linux, but I later found out there were problems with the popup windows on windows (it focuses on the base window, which hides the popup making it effectively a "pop under"). I apologize for not updating the patch in time.

To fix the issue: Line 840:

  //handle click event on tools buttons
  jQuery(this._box).find(this._options.toolSelector).click(function() {
    wym._iframe.contentWindow.focus();
    wym.exec(jQuery(this).attr(WYMeditor.NAME));
    return(false);
  });

Doing the focus before the exec call keeps us from call focus() on the iframe after we've created popup dialogs (and thus making them appear to "pop under").

Line 847:

  //handle click event on containers buttons
  jQuery(this._box).find(this._options.containerSelector).click(function() {
    wym.container(jQuery(this).attr(WYMeditor.NAME));
    wym._iframe.contentWindow.focus();
    return(false);
  });

This does a refocus on the editor window after we change the container type so that we don't lose our place.

I'm re-opening this, but I'm not sure if I should just create another ticket for it. If you'd like, you can re-close this and I'll make another.

comment:4 Changed 3 years ago by weswinham

Oops. Looks like I don't have permission to re-open.

comment:5 Changed 3 years ago by jf.hovinne

  • Status changed from closed to reopened
  • Resolution fixed deleted

OK, thanks for the feedback. I'm investigating this.

comment:6 Changed 3 years ago by jf.hovinne

  • Owner changed from jf.hovinne to weswinham
  • Status changed from reopened to new
  • Milestone set to 0.5

Fixed in r619.

I didn't apply the containers' patch, since we already call setFocusToNode() in container() and switchTo(), so the focus isn't lost (or perhaps I missed something?).

comment:7 Changed 3 years ago by jf.hovinne

FYI, you (and other authenticated users) now have the permission to reopen tickets - I've fixed the Trac config.

comment:8 follow-up: ↓ 9 Changed 3 years ago by weswinham

  • Status changed from new to closed
  • Resolution set to fixed

This looks great. You were right not to apply that containers' bit, as it looks like I missed that focus was returned without my changes. I've tested the r619 change in ie6 and FF3 and focus is now working as expected.

Also, on an unrelated note, I've attempted to create a bzr mirror of the trunk at launchpad:  https://code.launchpad.net/wymeditor There have been some problems getting the initial import to work, but as soon as that's all worked out, I'll post something up on the forums so people using bzr that would like to contribute to the project can do so more easily. Thanks again for your great work.

comment:9 in reply to: ↑ 8 Changed 3 years ago by jf.hovinne

Replying to weswinham:

This looks great. You were right not to apply that containers' bit, as it looks like I missed that focus was returned without my changes. I've tested the r619 change in ie6 and FF3 and focus is now working as expected.

OK, that's good news.

Also, on an unrelated note, I've attempted to create a bzr mirror of the trunk at launchpad:  https://code.launchpad.net/wymeditor There have been some problems getting the initial import to work, but as soon as that's all worked out, I'll post something up on the forums so people using bzr that would like to contribute to the project can do so more easily. Thanks again for your great work.

Good idea! Thanks for your help.

Note: See TracTickets for help on using tickets.