Browse Source

Fixes #3676 form submit on dropdown selection

pull/3704/head
Jack Lukic 8 years ago
parent
commit
d2bf6c4845
2 changed files with 8 additions and 4 deletions
  1. 1
      RELEASE-NOTES.md
  2. 11
      src/definitions/behaviors/form.js

1
RELEASE-NOTES.md

@ -11,6 +11,7 @@
-**Segment/Message** - Fixed issue where `top attached message` would have no border when attached to `segment` #3619 -**Segment/Message** - Fixed issue where `top attached message` would have no border when attached to `segment` #3619
-**Divider** - Fixed issue where descenders like "g" would be cut off in `horizontal divider` #3585 -**Divider** - Fixed issue where descenders like "g" would be cut off in `horizontal divider` #3585
-**Popup** - Fixed issue where checking `instanceof SVGGraphicsElement` caused error in IE11 #3043 -**Popup** - Fixed issue where checking `instanceof SVGGraphicsElement` caused error in IE11 #3043
-**Form Validation / Dropdown** - Fixed issue where using "enter" key in a `search dropdown` could cause a form to be submitted #3676
**Enhancements** **Enhancements**
- **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme** - **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme**

11
src/definitions/behaviors/form.js

@ -261,9 +261,12 @@ $.fn.form = function(parameters) {
field: { field: {
keydown: function(event) { keydown: function(event) {
var var
$field = $(this),
key = event.which,
keyCode = {
$field = $(this),
key = event.which,
isInput = $field.is(selector.input),
isCheckbox = $field.is(selector.checkbox),
isInDropdown = ($field.closest(selector.uiDropdown).length > 0),
keyCode = {
enter : 13, enter : 13,
escape : 27 escape : 27
} }
@ -274,7 +277,7 @@ $.fn.form = function(parameters) {
.blur() .blur()
; ;
} }
if(!event.ctrlKey && key == keyCode.enter && $field.is(selector.input) && $field.not(selector.checkbox).length > 0 ) {
if(!event.ctrlKey && key == keyCode.enter && isInput && !isInDropdown && !isCheckbox) {
if(!keyHeldDown) { if(!keyHeldDown) {
$field $field
.one('keyup' + eventNamespace, module.event.field.keyup) .one('keyup' + eventNamespace, module.event.field.keyup)

Loading…
Cancel
Save