Bug 419059 - contentAccess accesskeys for elements hidden with CSS don't work, r=neil, sr=roc, a=jst

This commit is contained in:
Olli Pettay 2008-12-30 16:09:14 +02:00
Родитель eea7b9969e
Коммит c441c5cffd
2 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -143,7 +143,7 @@
#include "nsServiceManagerUtils.h"
#include "nsITimer.h"
#include "nsIFontMetrics.h"
#include "nsIDOMXULDocument.h"
#include "nsIDragService.h"
#include "nsIDragSession.h"
#include "nsDOMDataTransfer.h"
@ -1545,10 +1545,17 @@ GetAccessModifierMask(nsISupports* aDocShell)
static PRBool
IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
{
if (!aFrame)
if (!aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::accesskey, aKey,
eIgnoreCase))
return PR_FALSE;
if (!aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::accesskey, aKey, eIgnoreCase))
nsCOMPtr<nsIDOMXULDocument> xulDoc =
do_QueryInterface(aContent->GetOwnerDoc());
if (!xulDoc && !aContent->IsNodeOfType(nsINode::eXUL))
return PR_TRUE;
// For XUL we do visibility checks.
if (!aFrame)
return PR_FALSE;
if (aFrame->IsFocusable())
@ -1560,6 +1567,7 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
if (!aFrame->AreAncestorViewsVisible())
return PR_FALSE;
// XUL controls can be activated.
nsCOMPtr<nsIDOMXULControlElement> control(do_QueryInterface(aContent));
if (control)
return PR_TRUE;

Просмотреть файл

@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
var modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK |
Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
var expectedFocus = "d,g,h,k,l,m";
var expectedFocus = "d,g,h,k,l,m,n";
// XXX the "map" test is causing trouble, see bug 433089
// var expectedClick = "a,b,c,e,f,i,j";
var expectedClick = "a,c,e,f,i,j";
@ -115,9 +115,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
function handleFocus(e) {
ok("accessKey" in e, "(focus) accesskey property not found on element");
var expected = focusArray.shift();
// "k" is a special case because the element receiving the focus is not
// the element which has the accesskey.
if (expected == "k") {
// "k" and "n" are a special cases because the element receiving the focus
// is not the element which has the accesskey.
if (expected == "k" || expected == "n") {
ok(e.value == "test for label", "(focus) unexpected element: " + e.value +
" expected: " + "test for label");
// "l" is a special case because the element receiving the focus is not
@ -312,7 +312,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
</tr>
<tr>
<td>label (label invisible)</td><td><label for="txt1" accesskey="n" style="display:none">test label</label>
<input type="text" id="txt1" value="test for label" onfocus="handleInvalid(event.target);"></td>
<input type="text" id="txt1" value="test for label" onfocus="handleFocus(event.target);"></td>
</tr>
<tr>
<td>label (control invisible)</td><td><label for="txt2" accesskey="o">test label</label>