On the main content search page (i.e., at /search/node), pressing the Enter key does not submit the search form in Internet Explorer -- instead, nothing happens at all (it acts just like the key was not touched).

This was discovered during the course of investigating http://drupal.org/node/194327 but it is a different bug and is not fixed by the patch there.

At least two of us experienced this bug with Internet Explorer (in my case with IE7).... although one person said it did not happen for them, so maybe it's only present in some versions of IE?

Also, the bug only appears when the Advanced Search fieldset is collapsed. If you open the Advanced Search fieldset, everything works fine. So it seems like fixing this would require "fooling" IE into seeing the whole form. Since the Enter key is literally ignored (i.e. the form is not submitted to the server at all), this can't be fixed with any post-processing on the server (as was done for the other bug listed above).

Any ideas?

Comments

scoutbaker’s picture

This is a duplicate of another issue. I'm having a heck of a time finding it. Will update when I do.

scoutbaker’s picture

Never mind me. I'm sure now I was thinking of node/194327 that you referenced where you first mentioned this issue.

scoutbaker’s picture

I reproduced this on IE7 7.0.5730.13.

I also know why I was thinking this was a duplicate issue. I discovered it some time ago and was going to enter a report on it. Then I forgot.

One additional piece of information that may help. On a D5.6 site, I get no action from pressing the Enter key whether the Advanced search fieldset is collapsed or expanded. On D6, it only does this with the fieldset collapsed, as you reported.

theborg’s picture

Status: Active » Needs work
StatusFileSize
new829 bytes

Workaround:

  1. IE looks for the default submit button when you position the caret cursor in a textfield. (you can see it opening the fieldset, the border of the 'advanced search' button changes)
  2. When you hit enter the selected button gets clicked.
  3. In the case the advanced search fieldset is hidden IE can't activate the button and beeps.

The advanced search button and the search button have the same function in this form.

In this patch I removed the advanced search button because we have the same functionality with the search button that already is there.

catch’s picture

Status: Needs work » Needs review

Personally, I don't think I've ever clicked the advanced search button, I always use the normal search one, and this is where the keywords are. So I'd be quite happy to see it taken out.

dman’s picture

Could it be because the buttons have the same ID? Bad mojo. Or has that been fixed?
... just a random guess.

David_Rothstein’s picture

StatusFileSize
new1.05 KB

I tested the patch, and it works great -- fixes the problem in IE7 and continues to work fine in Firefox.

The attached patch is the same as above but I also changed the fieldset title from "Advanced search" to "Advanced search options" -- I think leaving it at "Advanced search" could be a bit confusing because the user might reasonably expect a submit button to be there when they open it?

David_Rothstein’s picture

Also, following up on the comment by @catch, this patch has a nice UI improvement as a side effect to the bug fix:

With the submit button present, users tend to think the advanced search fieldset is its own separate form, so they might be surprised to find that their original keywords get appended to whatever they type in the advanced search area. This patch fixes that. (However, in my opinion the best UI would be one in which advanced search is its own separate form, automatically prepopulated with the original search keywords. But that sounds like a task for Drupal 7.)

scoutbaker’s picture

@theborg - thanks for the patch. This seems to work as advertised.

@David_R - #7 is a good suggestion. I hope it makes it past the string freeze. #8 sounds like a great request for D7.

moshe weitzman’s picture

someone who has tested this should set to rtbc.

scoutbaker’s picture

Status: Needs review » Reviewed & tested by the community

I tested one more time and this patch is working correctly.

Edit:
My testing was simple:

  1. Unpatched - browse to /search/node
  2. Enter a search term, "test"
  3. Press Enter - nothing happens
  4. Apply the patch
  5. Browse to /search/node
  6. Enter a search term, "test"
  7. Press Enter - the search is performed
  8. Expand "Advanced search options" - note the change of string and the missing Advanced search button
  9. Enter a search term, "test2"
  10. Press Enter - the search is performed
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Well, I am not sure we should fiddle with the user experience here. What about renaming the second submit button to "submit_advanced" or something?

David_Rothstein’s picture

Here is the current HTML.

Main search button:
<input type="submit" name="op" id="edit-submit" value="Search" class="form-submit" />

Advanced search button:
<input type="submit" name="op" id="edit-submit-1" value="Advanced search" class="form-submit" />

So it looks like the concern in #6 is not a problem -- the buttons already have unique IDs. In that case, I don't see how changing any of the names here could be expected to fix the bug?

gábor hojtsy’s picture

So what's causing the problem after all?

catch’s picture

Looks like the duplicate name="op" to me.

theborg’s picture

Status: Needs work » Needs review
StatusFileSize
new1.68 KB

Well, that was difficult to find. I think that the problem is a bug with IE and collapse.js.

To test, disable javascript, or better set the fieldset to '#collapsible' => FALSE and the problem is gone, when you position the caret cursor over the search textbox the default button is not changing.

On my tests, if you add html to the fieldset including div.action, the bug reproduces. Also the effects slideUp and slideDown (that are changing properties) are also a cause for the bad behavior.

In this patch:
a) Exclude the buttons container (div.action) from the wrapper.
b) Only use hide() and show() effects with div.action when animating the fieldset.

theborg’s picture

Title: Internet Explorer: Enter key doesn't work on search page » Internet Explorer: Default submit button altered by collapse.js

Please do test this patch with Opera and Safari.

catch’s picture

Tested this on IE7, FF2, Opera 9 and Safari 3. Worked fine for me on all, both the original bug, and the fieldset on the search page + cotnent-type settings form (which has some big fieldsets so seemed like a good candidate for breakage).

Will leave at needs review for a second set of eyes, but looks great.

David_Rothstein’s picture

Status: Needs review » Reviewed & tested by the community

Nice job tracking this down! I tested with IE6, IE7, FF1.5, FF2, Safari 3, and Opera 9 and same results here -- everything works fine. Seems like this is RTBC.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch and for the extensive testing, committed.

Ps. may I ask you to hop over to http://drupal.org/node/214329 and help out with testing there if you have time? Thanks!

David_Rothstein’s picture

Following up on #8 and other discussion above, I filed a feature request for Drupal 7 to improve the advanced search interface: http://drupal.org/node/215735

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.