Skip to content
  • aroben@apple.com's avatar
    Fix <rdar://5483519> Pressing Enter on selected buttons should fire onclick · 745cedc5
    aroben@apple.com authored
     LayoutTests:
    
             Add a test for <rdar://5483519> Pressing Enter on selected buttons should fire onclick
    
             Reviewed by Adele.
    
             * fast/forms/enter-clicks-buttons-expected.txt: Added.
             * fast/forms/enter-clicks-buttons.html: Added.
    
     WebCore:
    
             Fix <rdar://5483519> Pressing Enter on selected buttons should fire onclick
    
             We now match the behavior of Firefox and IE, which is to always just
             send a click event to the focused button when the Enter key is pressed
             (previously we were submitting forms directly in some cases).
    
             Reviewed by Adele.
    
             Test: fast/forms/enter-clicks-buttons.html
    
             * html/HTMLButtonElement.cpp:
             (WebCore::HTMLButtonElement::defaultEventHandler): Don't do anything
             fancy when Enter is pressed on a <button type=button> -- just send a
             click event like we do for other button types.
             * html/HTMLInputElement.cpp:
             (WebCore::HTMLInputElement::defaultEventHandler): Treat type=button
             the same way we treat type=submit and type=reset: just send a click
             event when Enter is pressed.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27652 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    745cedc5