Page MenuHomePhabricator

Pressing ENTER on editbox should not submit the search form
Open, MediumPublic

Description

Now that T26566 was fixed by gerrit change 17654, a new bug became visible: "for some reason, if I open the search and replace dialog, find something and then I click on the edit box and press ENTER it submit the search dialog instead of adding a new line."


Version: unspecified
Severity: normal

Details

Reference
bz39357

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:49 AM
bzimport set Reference to bz39357.
bzimport added a subscriber: Unknown Object (MLST).

logical:

$( textbox )
      .bind( 'keypress.srdialog', function ( e ) {
              if ( e.which == 13 ) {
                      // Enter
                      var button = dialog.data( 'dialogaction' ) || dialog.find( 'button:first' );
                      button.click();
                      e.preventDefault();
              } else if ( e.which == 27 ) {
                      // Escape
                      $(that).dialog( 'close' );
              }
      });

Now to solve it...

probably better to this with exact match.

Change 19942 abandoned by TheDJ:
Enter in editbox should not submit Search dialog

https://gerrit.wikimedia.org/r/19942

Change abandoned after 11 months.

(In reply to comment #5)

Change abandoned after 11 months.

For which reason? No answer on your last commit in Gerrit and frustration, or are there actually technical reasons?

@Vishwaak: I am resetting the assignee of this task because there has not been progress lately (please correct me if I am wrong!). Resetting the assignee avoids the impression that somebody is already working on this task. It also allows others to potentially work towards fixing this task. Please claim this task again when you plan to work on it (via Add Action...Assign / Claim in the dropdown menu) - it would be welcome! Thanks for your understanding!

The current situation (assuming a search term is found on the page):

  • Pressing Enter on the search dialog finds the first search result.
  • Focus is passed to the text area, with the search term selected.
  • If you press Enter again (presumably to find the next search result), you're actually in the text area's context. The text area's handler tries to "click" a non-existent button, i.e. it does nothing.
  • Pressing Esc does nothing. According to the jQuery docs, you need a keydown event, not keypress, to recognize Esc.

What do we want instead?

I actually feel the optimal behavior is a hybrid of the two:

  • Enter should cycle through the search results.
  • However, if the user explicitly selects the text area, it should input a new line.

Thoughts?