Closed Bug 280220 Opened 20 years ago Closed 20 years ago

Need to expose which anchors are named

Categories

(Core :: Disability Access APIs, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: aaronlev, Assigned: aaronlev)

Details

(Keywords: access)

Attachments

(1 file, 1 obsolete file)

Screen readers want to know which anchors are named, and which are links. An anchor could be both a link and be a named anchor. From now on, for ROLE_LINK objects: STATE_LINKED will indicate that it's a link STATE_SELECTABLE will indicate that it's a named anchor (no better state to use, selectable in this context means the named anchor can be selected as a location to visit.
Raising to critical because in the previous code (checked in last night), we don't check mLinkContent before using it. Bill Smith is reporting that get_accState() is crashing in today's build, which is consistent with that error. This patch makes sure only to use mLinkContent when we're really a link.
Severity: normal → critical
Comment on attachment 172706 [details] [diff] [review] 1) Don't return true for IsALink() unless it has an href. 2) Use STATE_LINKED if it is a link, 3) Use STATE_SELECTABLE if has name attribute >Index: accessible/src/base/nsBaseWidgetAccessible.cpp >=================================================================== >RCS file: /cvsroot/mozilla/accessible/src/base/nsBaseWidgetAccessible.cpp,v >retrieving revision 1.31 >diff -p -u -5 -r1.31 nsBaseWidgetAccessible.cpp >--- accessible/src/base/nsBaseWidgetAccessible.cpp 28 Jan 2005 02:35:25 -0000 1.31 >+++ accessible/src/base/nsBaseWidgetAccessible.cpp 28 Jan 2005 18:43:21 -0000 >@@ -191,23 +191,21 @@ NS_IMETHODIMP nsLinkableAccessible::GetS ... >+ if (!mLinkContent->IsFocusable()) { >+ *aState &= ~STATE_FOCUSABLE; // Links must have href or tabindex >+ } Fix whitespace here.
Attachment #172706 - Flags: review?(pkwarren) → review+
Comment on attachment 172706 [details] [diff] [review] 1) Don't return true for IsALink() unless it has an href. 2) Use STATE_LINKED if it is a link, 3) Use STATE_SELECTABLE if has name attribute Thanks. Whitespace fixed.
Attachment #172706 - Flags: superreview?(bzbarsky)
Is there a reason not to get the HrefURI (using the nsILink api we're already QIed to)? That's more likely to work in general (eg for XLinks in XHTML documents, etc). Also, are we purposefully including <link> elements here as links?
We don't try and handle xlink's yet. That will come later. We only care about <area> and <a> here. Would it be better to use Tag() since I know we just want area and a?
Yes, probably. Note that it's possible to have an <a> with a nonempty href attribute that is not a link (the user can't click on it) if the value of the href attribute is just not a URI in any sort of reasonable way. So you'd still want to check the HrefURI, not the attribute. Also note that as far as a user is concerned, <link> and <a> act the same (the <link> is underlined and blue, and clicking on it takes you to the href). So depending on what your requirements are, you may in fact want to treat them both as links.... I'm just not sure what the definition of "link" is in this code. See nsStyleUtil::IsHTMLLink for how to tell whether something is an "html link" (though this does link state too, which you may not care about), and tries to avoid the QI to nsILink if it can, which you may also not care about.
Attachment #172706 - Flags: superreview?(bzbarsky) → superreview-
Comment on attachment 172787 [details] [diff] [review] First check Tag() to see if <a> or <area>, then check nsILink::GetHrefURI() to see if it is a valid link sr=bzbarsky, but I don't think you need the href atom anymore...
Attachment #172787 - Flags: superreview?(bzbarsky) → superreview+
Checking in accessible/src/base/nsAccessibilityAtomList.h; /cvsroot/mozilla/accessible/src/base/nsAccessibilityAtomList.h,v <-- nsAccessibilityAtomList.h new revision: 1.10; previous revision: 1.9 done Checking in accessible/src/base/nsBaseWidgetAccessible.cpp; /cvsroot/mozilla/accessible/src/base/nsBaseWidgetAccessible.cpp,v <-- nsBaseWidgetAccessible.cpp new revision: 1.32; previous revision: 1.31 done Checking in accessible/src/html/nsHTMLLinkAccessible.cpp; /cvsroot/mozilla/accessible/src/html/nsHTMLLinkAccessible.cpp,v <-- nsHTMLLinkAccessible.cpp new revision: 1.17; previous revision: 1.16 done
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: