button_to_function & safari 3

Has anyone else noticed that buttons rendered with button_to_function
in Safari don't work when you hit return? Works find in firefox. Is
there a know work around?

Hm.. I just did a quick test and when I tabbed to the button and
pressed return, it submitted the form. Maybe you have something else

Safari 3.0.4 (523.12) on Mac OS X 10.4.11 and Windows XP SP2.



Sorry, Pat. Just looked a little closer and saw that you said button_to_function, not button_to. That’s a different story, but I do have some information for you. I ran into the same problem last night and it’s because there’s no form element. According to someone on the web-dev Apple list, it’s a bug in Safari (which I have not yet filed…Maybe we both should :slight_smile: ). You can get around it in one of two ways:

  1. put a form around the

  2. change it to …

Granted, that means you will have to create your html without using button_to_function, but it will work.

Here’s the text an the exchange I had last night/this morning:

In addition to my second message, I also found this link on the WebKit Bugzilla:


It’s not the same test case, but the bug is the same. However, part way down the comments, a person named Dave Hyatt states

========== begin comment ===========

There is no bug on Mac. This is really a Windows port issue.

On the Mac, spacebar activates a button, and Enter activates the default button

in dialogs. The two are distinct. This is expected behavior to a Mac user.

On Windows this is not the case (Enter always activates the focused button, and

only activates the default button if another button is not focused).

========== end comment ===========

Since I’m new to the Mac (past 7 months or so), this was new to me. I did test my case again using the space bar and it worked fine.

Go figure.