Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
2db02858
Commit
2db02858
authored
12 years ago
by
Shane Tomlinson
Browse files
Options
Downloads
Patches
Plain Diff
Fix submit occuring when selecting an email address in Firefox from the autocomplete list.
issue #1780
parent
a976e5a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
resources/static/shared/modules/page_module.js
+2
-2
2 additions, 2 deletions
resources/static/shared/modules/page_module.js
resources/static/test/cases/shared/modules/page_module.js
+5
-4
5 additions, 4 deletions
resources/static/test/cases/shared/modules/page_module.js
with
7 additions
and
6 deletions
resources/static/shared/modules/page_module.js
+
2
−
2
View file @
2db02858
...
...
@@ -15,7 +15,7 @@ BrowserID.Modules.PageModule = (function() {
cancelEvent
=
helpers
.
cancelEvent
,
mediator
=
bid
.
Mediator
;
function
onKeyp
ress
(
event
)
{
function
onKey
u
p
(
event
)
{
if
(
event
.
which
===
13
)
{
// IE8 does not trigger the submit event when hitting enter. Submit the
// form if the key press was an enter and prevent the default action so
...
...
@@ -69,7 +69,7 @@ BrowserID.Modules.PageModule = (function() {
self
.
options
=
options
||
{};
self
.
bind
(
"
form
"
,
"
submit
"
,
cancelEvent
(
onSubmit
));
self
.
bind
(
"
input
"
,
"
keyp
ress
"
,
onKeyp
ress
);
self
.
bind
(
"
input
"
,
"
key
u
p
"
,
onKey
u
p
);
},
stop
:
function
()
{
...
...
This diff is collapsed.
Click to expand it.
resources/static/test/cases/shared/modules/page_module.js
+
5
−
4
View file @
2db02858
...
...
@@ -200,7 +200,7 @@
equal
(
submitCalled
,
true
,
"
submit permitted to complete
"
);
});
test
(
"
form is submitted on
ce
'enter keyp
ress
' event
"
,
function
()
{
test
(
"
form is submitted on 'enter key
u
p' event
"
,
function
()
{
createController
();
controller
.
renderDialog
(
"
test_template_with_input
"
,
{
title
:
"
Test title
"
,
...
...
@@ -216,14 +216,15 @@
};
// synthesize the entire series of key* events so we replicate the behavior
// of keyboard interaction.
// of keyboard interaction. The order of events is keydown, keypress,
// keyup (http://unixpapa.com/js/key.html).
var
e
=
jQuery
.
Event
(
"
keydown
"
,
{
keyCode
:
13
,
which
:
13
});
$
(
"
#templateInput
"
).
trigger
(
e
);
var
e
=
jQuery
.
Event
(
"
key
u
p
"
,
{
keyCode
:
13
,
which
:
13
});
var
e
=
jQuery
.
Event
(
"
keyp
ress
"
,
{
keyCode
:
13
,
which
:
13
});
$
(
"
#templateInput
"
).
trigger
(
e
);
var
e
=
jQuery
.
Event
(
"
keyp
ress
"
,
{
keyCode
:
13
,
which
:
13
});
var
e
=
jQuery
.
Event
(
"
key
u
p
"
,
{
keyCode
:
13
,
which
:
13
});
$
(
"
#templateInput
"
).
trigger
(
e
);
equal
(
submitCalled
,
1
,
"
submit called a single time
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment