Browse files

Fixing Issue #58 - Nested input elements not accessible

  • Loading branch information...
1 parent 5189212 commit fe26ef065c80cca94f4b8d85f55cf54c52688590 @rodneyrehm rodneyrehm committed Jun 26, 2012
Showing with 30 additions and 8 deletions.
  1. +3 −2 src/jquery.contextMenu.css
  2. +27 −6 src/jquery.contextMenu.js
View
5 src/jquery.contextMenu.css
@@ -50,11 +50,12 @@
border-bottom: 1px solid #DDD;
}
-.context-menu-item > label {
+.context-menu-item > label > input,
+.context-menu-item > label > textarea {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
- user-select: text;
+ user-select: text;
}
.context-menu-item.hover {
View
33 src/jquery.contextMenu.js
@@ -21,6 +21,28 @@
// determine html5 compatibility
$.support.htmlMenuitem = ('HTMLMenuItemElement' in window);
$.support.htmlCommand = ('HTMLCommandElement' in window);
+$.support.eventSelectstart = ("onselectstart" in document.documentElement);
+/* // should the need arise, test for css user-select
+$.support.cssUserSelect = (function(){
+ var t = false,
+ e = document.createElement('div');
+
+ $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) {
+ var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect',
+ prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select';
+
+ e.style.cssText = prop + ': text;';
+ if (e.style[propCC] == 'text') {
+ t = true;
+ return false;
+ }
+
+ return true;
+ });
+
+ return t;
+})();
+*/
var // currently active contextMenu trigger
$currentTrigger = null,
@@ -1048,12 +1070,11 @@ var // currently active contextMenu trigger
$t.appendTo(opt.$menu);
// Disable text selection
- if (!opt.hasTypes) {
- if($.browser.msie) {
- $t.on('selectstart.disableTextSelect', handle.abortevent);
- } else if(!$.browser.mozilla) {
- $t.on('mousedown.disableTextSelect', handle.abortevent);
- }
+ if (!opt.hasTypes && $.support.eventSelectstart) {
+ // browsers support user-select: none,
+ // IE has a special event for text-selection
+ // browsers supporting neither will not be preventing text-selection
+ $t.on('selectstart.disableTextSelect', handle.abortevent);
}
});
// attach contextMenu to <body> (to bypass any possible overflow:hidden issues on parents of the trigger element)

0 comments on commit fe26ef0

Please sign in to comment.