[richfaces-issues] [JBoss JIRA] Created: (RF-6537) Elements outside of the modal panel could receive focus using tab key.

Sergey Rusak (JIRA) jira-events at lists.jboss.org
Tue Mar 17 13:31:22 EDT 2009


Elements outside of the modal panel could receive focus using tab key.
----------------------------------------------------------------------

                 Key: RF-6537
                 URL: https://jira.jboss.org/jira/browse/RF-6537
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.3.1
            Reporter: Sergey Rusak


Elements outside of the modal panel could receive focus using tab key. According to the current algorithm onfocus listener is added to the very first focusable element on the page to automatically redirect focus to the first element on the modal panel. This works fine unless the very first element is not visible( display='none' in my case). The solution could be adding the additional check to filter invisible elements(modalPanle.js):   
{code:java}
	processAllFocusElements: function(root, callback) {
		var idx = -1;
		var tagName;

		if (root.focus && root.nodeType == 1 && (tagName = root.tagName) &&
			// Many not visible elements have focus method, we had to avoid processing them.
			(idx = this.formElements.indexOf(tagName.toLowerCase())) != -1 &&
			this.formElements.charAt(idx - 1) === '|' && 
			this.formElements.charAt(idx + tagName.length) === '|' &&
			!root.disabled && root.type!="hidden"
			&& (Richfaces.getComputedStyle(root,'display')!='none')
			&& (Richfaces.getComputedStyle(root,'visibility')!='hidden')){
				callback.call(this, root);
		} else {
			if (root != this.id) {
				var child = root.firstChild;
				while (child) {				
					if (!child.style || child.style.display != 'none') {
						this.processAllFocusElements(child, callback);
					}
					child = child.nextSibling;
				}
			}
		}
	}
{code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list