Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
13c9612a
Commit
13c9612a
authored
Aug 14, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let an additional tab select the currently highlighted element
parent
2abd1c1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
spec/autocomplete.js
spec/autocomplete.js
+21
-0
src/converse-autocomplete.js
src/converse-autocomplete.js
+6
-6
No files found.
spec/autocomplete.js
View file @
13c9612a
...
...
@@ -44,6 +44,7 @@
const
tab_event
=
{
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
stopPropagation
'
:
_
.
noop
,
'
keyCode
'
:
9
}
view
.
keyPressed
(
tab_event
);
...
...
@@ -102,6 +103,26 @@
'
keyCode
'
:
13
});
expect
(
textarea
.
value
).
toBe
(
'
hello s some2
'
);
// Test that pressing tab twice selects
presence
=
$pres
({
'
to
'
:
'
dummy@localhost/resource
'
,
'
from
'
:
'
lounge@localhost/z3r0
'
})
.
c
(
'
x
'
,
{
xmlns
:
Strophe
.
NS
.
MUC_USER
})
.
c
(
'
item
'
,
{
'
affiliation
'
:
'
none
'
,
'
jid
'
:
'
z3r0@localhost/resource
'
,
'
role
'
:
'
participant
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
textarea
.
value
=
"
hello z
"
;
view
.
keyPressed
(
tab_event
);
view
.
keyUp
(
tab_event
);
view
.
keyPressed
(
tab_event
);
view
.
keyUp
(
tab_event
);
expect
(
textarea
.
value
).
toBe
(
'
hello z3r0
'
);
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
...
...
src/converse-autocomplete.js
View file @
13c9612a
...
...
@@ -116,7 +116,6 @@
while
(
li
&&
!
(
/li/i
).
test
(
li
.
nodeName
))
{
li
=
li
.
parentNode
;
}
if
(
li
&&
evt
.
button
===
0
)
{
// Only select on left click
evt
.
preventDefault
();
this
.
select
(
li
,
evt
.
target
);
...
...
@@ -267,19 +266,19 @@
keyPressed
(
ev
)
{
if
(
this
.
opened
)
{
if
(
ev
.
keyCode
===
_converse
.
keycodes
.
ENTER
&&
this
.
selected
)
{
if
(
_
.
includes
([
_converse
.
keycodes
.
ENTER
,
_converse
.
keycodes
.
TAB
],
ev
.
keyCode
)
&&
this
.
selected
)
{
ev
.
preventDefault
();
ev
.
stopPropagation
();
this
.
select
();
return
fals
e
;
return
tru
e
;
}
else
if
(
ev
.
keyCode
===
_converse
.
keycodes
.
ESCAPE
)
{
this
.
close
({
'
reason
'
:
'
esc
'
});
return
fals
e
;
}
else
if
(
ev
.
keyCode
===
_converse
.
keycodes
.
UP_ARROW
||
ev
.
keyCode
===
_converse
.
keycodes
.
DOWN_ARROW
)
{
return
tru
e
;
}
else
if
(
_
.
includes
([
_converse
.
keycodes
.
UP_ARROW
,
_converse
.
keycodes
.
DOWN_ARROW
],
ev
.
keyCode
)
)
{
ev
.
preventDefault
();
ev
.
stopPropagation
();
this
[
ev
.
keyCode
===
_converse
.
keycodes
.
UP_ARROW
?
"
previous
"
:
"
next
"
]();
return
fals
e
;
return
tru
e
;
}
}
...
...
@@ -327,6 +326,7 @@
}
this
.
suggestions
=
this
.
suggestions
.
slice
(
0
,
this
.
max_items
);
this
.
suggestions
.
forEach
((
text
)
=>
this
.
ul
.
appendChild
(
this
.
item
(
text
,
value
)));
this
.
next
();
if
(
this
.
ul
.
children
.
length
===
0
)
{
this
.
close
({
'
reason
'
:
'
nomatches
'
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment