Opened 9 years ago

Closed 4 years ago

#10698 closed enhancement (patchwelcome)

InlineEditBox: add onEdit, onManageFocus callbacks

Reported by: coa Owned by:
Priority: low Milestone: 1.13
Component: Dijit Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

I would like to propose the addition of two callbacks to the InlineEditBox?-widget.

  • onEdit(): a callback that fires just before the edit box opens, to allow the developer to make necessary changes (e.g. dojo.setSelectable)
  • onManageFocus(/*Boolean*/ focus): a callback that gives the developer the choice of sidestepping the automatic focus management when the edit box is closed. It it's NOT present, nothing should be different.

Any thoughts?

Change History (8)

comment:1 Changed 9 years ago by Douglas Hays

Owner: set to Douglas Hays

comment:2 Changed 9 years ago by Douglas Hays

I'm not a fan of the focus idea. I'll need to better understand why alternate focus behavior is good for the webpage enduser. This gets complicated when they TAB out of an editing widget and expect the focus to go to the next tab-stop.
The onEdit makes a little sense but that can already be achieved easily and any other explicit support would be API bloat:

<script type="dojo/method" event="edit">
        // your pre-processing here
        this.inherited('edit', arguments);
</script>

comment:3 Changed 9 years ago by coa

onFocus

As I see it, the alternate focus behavior is relevant when having more than one InlineEdit?-field, AND they together constitute some sort of group or formation (trees leaves, lists, grid cells, etc.)

In such a "list" environment, you might want "spreadsheet-like" behavior of the focus, i.e. when you press ENTER, focus moves to the next cell / edit field.

The problem is, however, that you'd probably NOT want it to go to the next "cell" if you pressed ESC and the current code does not differentiate between these situations in the function you'd have to override to accomplish custom focus behavior today ('_showText').

Overriding focus management (in a meaningful context-dependent way) is actually quite complicated, as the code is right now, as you'd have to override several methods.

Nevertheless, I don't think TAB-ing makes things more complicated, as the callback would only be relevant when the boolean argument to _showText is true, and it never is for TABs.

onEdit

I agree that onEdit already can be achieved. However, using the same argument, onCancel would be superfluous as it can already be achieved by:

<script type="dojo/method" event="cancel"></script>

I just figured the "start edit"-event was a sufficiently important event in the InlineEditBox?-widget's life to merit a callback.

comment:4 Changed 9 years ago by Douglas Hays

Milestone: tbdfuture

No immediate plans to implement this. Feel free to contribute a patch as long as it contains sufficient automated tests (most likely using the doh.robot).

comment:5 Changed 7 years ago by bill

Priority: highlow
Summary: Additional callbacks for InlineEditBox: onEdit, onManageFocusInlineEditBox: add onEdit, onManageFocus callbacks

comment:6 Changed 5 years ago by Douglas Hays

Owner: Douglas Hays deleted
Status: newassigned

comment:7 Changed 5 years ago by Douglas Hays

Status: assignedopen

comment:8 Changed 4 years ago by dylan

Milestone: future1.12
Resolution: patchwelcome
Status: openclosed

Given that no one has shown interest in creating a patch in the past 5+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.