Skip to content

Commit fe26ef0

Browse files
committed
Fixing Issue swisnl#58 - Nested input elements not accessible
1 parent 5189212 commit fe26ef0

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

src/jquery.contextMenu.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@
5050
border-bottom: 1px solid #DDD;
5151
}
5252

53-
.context-menu-item > label {
53+
.context-menu-item > label > input,
54+
.context-menu-item > label > textarea {
5455
-webkit-user-select: text;
5556
-moz-user-select: text;
5657
-ms-user-select: text;
57-
user-select: text;
58+
user-select: text;
5859
}
5960

6061
.context-menu-item.hover {

src/jquery.contextMenu.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@
2121
// determine html5 compatibility
2222
$.support.htmlMenuitem = ('HTMLMenuItemElement' in window);
2323
$.support.htmlCommand = ('HTMLCommandElement' in window);
24+
$.support.eventSelectstart = ("onselectstart" in document.documentElement);
25+
/* // should the need arise, test for css user-select
26+
$.support.cssUserSelect = (function(){
27+
var t = false,
28+
e = document.createElement('div');
29+
30+
$.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) {
31+
var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect',
32+
prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select';
33+
34+
e.style.cssText = prop + ': text;';
35+
if (e.style[propCC] == 'text') {
36+
t = true;
37+
return false;
38+
}
39+
40+
return true;
41+
});
42+
43+
return t;
44+
})();
45+
*/
2446

2547
var // currently active contextMenu trigger
2648
$currentTrigger = null,
@@ -1048,12 +1070,11 @@ var // currently active contextMenu trigger
10481070
$t.appendTo(opt.$menu);
10491071

10501072
// Disable text selection
1051-
if (!opt.hasTypes) {
1052-
if($.browser.msie) {
1053-
$t.on('selectstart.disableTextSelect', handle.abortevent);
1054-
} else if(!$.browser.mozilla) {
1055-
$t.on('mousedown.disableTextSelect', handle.abortevent);
1056-
}
1073+
if (!opt.hasTypes && $.support.eventSelectstart) {
1074+
// browsers support user-select: none,
1075+
// IE has a special event for text-selection
1076+
// browsers supporting neither will not be preventing text-selection
1077+
$t.on('selectstart.disableTextSelect', handle.abortevent);
10571078
}
10581079
});
10591080
// attach contextMenu to <body> (to bypass any possible overflow:hidden issues on parents of the trigger element)

0 commit comments

Comments
 (0)