Closed Bug 267119 Opened 20 years ago Closed 14 years ago

[FIX] anchor element without href but with tabindex can't receive focus

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set
minor

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: martijn.martijn, Assigned: MatsPalmgren_bugz)

References

Details

(Keywords: testcase)

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20041031 Firefox/0.9.1+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20041031 Firefox/0.9.1+

This only happens in trunk (1.8a) builds (or only relevant in 1.8a builds).
See upcoming testcase.
An anchor element without the href attribute but with tabindex="1" set, is not
focusable, while it should be.

Reproducible: Always
Steps to Reproduce:
1. See testcase
2.
3.

Actual Results:  
Anchor element not focusable

Expected Results:  
Anchor element focusable.
Attached file Testcase
Keywords: testcase
Assignee: nobody → mats.palmgren
Severity: normal → minor
Component: Layout → Keyboard: Navigation
OS: Windows 2000 → All
Hardware: PC → All
Summary: anchor element without href but with tabindex can't receive focus → [FIX] anchor element without href but with tabindex can't receive focus
related to Bug 267427 ?
Attached file Testcase #2
Status: NEW → ASSIGNED
Attached patch Patch rev. 1Splinter Review
This patch does minimal impact on ESM, but maybe the whole block:

    // Add better focusable test here later if necessary ...
    if (tag == nsHTMLAtoms::a &&
	testContent->IsContentOfType(nsIContent::eHTML)) {
      *aIsSelectionWithFocus = PR_TRUE;
    }
    else {
      *aIsSelectionWithFocus = testContent->HasAttr(kNameSpaceID_XLink,
nsHTMLAtoms::href);
      if (*aIsSelectionWithFocus) {
	nsAutoString xlinkType;
	testContent->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::type, xlinkType);

	if (!xlinkType.EqualsLiteral("simple")) {
	  *aIsSelectionWithFocus = PR_FALSE;  // Xlink must be type="simple"
	}
      }
    }

Can be replaced with:

*aIsSelectionWithFocus = testContent->IsFocusable(nsnull);

I'm not to sure about the various XLink types though... comments?
> I'm not to sure about the various XLink types though... comments?

XLinks do the right thing for isFocusable ever since bug 261707 was fixed.  See
http://lxr.mozilla.org/seamonkey/source/content/xml/content/src/nsXMLElement.cpp#420
QA Contact: layout → keyboard.navigation
The "receive focus" part is worksforme.  Adding the focus outline style
is being fixed in bug 652301.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Depends on: 652301
Resolution: --- → WORKSFORME
Component: Keyboard: Navigation → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: