Closed
Bug 280065
Opened 20 years ago
Closed 19 years ago
XUL text-link widget is not accessible
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: aaronlev, Assigned: parente)
References
Details
(Keywords: access)
Attachments
(2 files, 9 obsolete files)
9.02 KB,
patch
|
neil
:
superreview+
asa
:
approval1.8b4+
|
Details | Diff | Splinter Review |
9.16 KB,
patch
|
Details | Diff | Splinter Review |
Right now we use <label class="text-link"> for our link widget. First, it does not make sense that we use a class to add a widget with functionality. A link should have it's own XUL tag, like <link> or <textlink>, with a src attribute or something. http://lxr.mozilla.org/seamonkey/source/toolkit/content/widgets/text.xml#211 Whether we decide to create a new link tag or not, we do need to implement nsIAccessibleProvider for this element and create a xul link accessible that exposes ROLE_LINK for it.
I started modifying the existing text-link binding. Two problems. First, I keep getting a security error when trying to open the link href from XBL. Second, XUL ignores the link tag event after I've modified the xul.css file. The test case demonstrates that creating new classes in the xul.css file works as expected, but creating new, top level styles representing new tags does not. I must be missing something.
Comment 5•19 years ago
|
||
Comment on attachment 185023 [details] Modifications to text-link binding >openDialog('chrome://browser/content/browser.xul', '_blank', 'chrome,all,dialog=no', href, null, null); Why not just open(href)?
Comment 6•19 years ago
|
||
(In reply to comment #4) >The test case demonstrates that creating new classes in the xul.css file works >as expected, but creating new, top level styles representing new tags does not. >I must be missing something. Perhaps you forgot to tell your <link> tag that it should be displaying text?
Reporter | ||
Comment 7•19 years ago
|
||
(In reply to comment #6) > (In reply to comment #4) > >The test case demonstrates that creating new classes in the xul.css file works > >as expected, but creating new, top level styles representing new tags does not. > >I must be missing something. > Perhaps you forgot to tell your <link> tag that it should be displaying text? Neil, where/how does one do that?
Comment 8•19 years ago
|
||
Something like <binding ... display="xul:text" ...> should work.
That's works, sort of. The formatting is a bit off when compared with the other text. So if the binding is being attached to a "top level" tag (e.g. <link />) it needs to be explicitly displayed whereas when it's attached to a class (e.g. <label class="text-link" />) it doesn't? The same binding is being used in both cases and is visible in the second case but not the first without using "xul: display".
Comment 10•19 years ago
|
||
(In reply to comment #9) >The formatting is a bit off when compared with the other text. Possibly because your theme is styling the label tag but not the link tag? >So if the binding is being attached to a "top level" tag (e.g. <link />) it >needs to be explicitly displayed whereas when it's attached to a class (e.g. ><label class="text-link" />) it doesn't? The same binding is being used in both >cases and is visible in the second case but not the first without using "xul: >display". <label> tags already know (hardwired in nsCSSFrameConstructor) to display text.
Assignee | ||
Comment 11•19 years ago
|
||
It appears that there is still on-going discussion (http://wiki.mozilla.org/XUL: New_Widgets) about whether or not a xul:link tag is desired or whether html:a should be used instead. Plus, the text-link style is referenced repeatedly throughout a number of stylesheets and themes. I'm guessing it'll have to be slowly deprecated to allow the themes to catch up and use link instead. In the mean time, it might make more sense just to 1) make the text-link binding accessible as ROLE_LINK, 2) give it an href attribute, and 3) have it provide a convience click handler that opens the URL given by the href. If it turns out people want xul:link later, they can simply attach the text-link binding to the link tag.
Attachment #185023 -
Attachment is obsolete: true
Attachment #185024 -
Attachment is obsolete: true
Attachment #185025 -
Attachment is obsolete: true
Assignee | ||
Comment 12•19 years ago
|
||
Attachment #187125 -
Flags: review?(aaronleventhal)
Assignee | ||
Comment 13•19 years ago
|
||
Relies on patch for bug 298572 to report accessible name properly. Cannot provide standalone test case because of security problems (bug 297069). Best way to test is to modify the label in http://lxr.mozilla.org/seamonkey/source/toolkit/mozapps/extensions/content/extensions.xul#286 so it is a link: <label class="text-link" href="foobar" /> Note this patch is binding independent so if text-link disappears later, it will continue to work. The binding only needs to invoke createXULLinkAccessible on the IAccessibilityService to expose itself as a link.
Attachment #187126 -
Flags: review?(aaronleventhal)
Attachment #187125 -
Attachment is obsolete: true
Attachment #187125 -
Flags: review?(aaronleventhal)
Reporter | ||
Comment 14•19 years ago
|
||
Comment on attachment 187126 [details] [diff] [review] XULTextAccessible first try - binding independent I don't see anyone using CreateXULLinkAccessible(). Did the XBL part of the patch accidentally get left out? Nits: In general check the coding style guidelines on mozilla.org. You're doing some stuff I did too, before working in Mozilla and people want all the whitespace just so, yada yada yada. Always put a space before and after operators, including the ? operator in ? : For methods, always put the { on a new line, as in: +PRBool nsXULLinkAccessible::IsALink() { All the _retval's in method params came from a time when I didn't know better. Don't follow that custom. Use aFoo for paramater names. Keep new #include's alphabetized (although ignoring the "nsI" bit and keeping the matching header for the .cpp as the first one). Collapse these into 1 line: nsresult rv; rv = nsLinkableAccessible::GetState(_retval); Always put a space before ( Always use { and }, even for 1 line, at least in this module. Don't ask. A lot of sr='s started requiring that when a bad smoketest blocking bug was created because of a { } mistake. Don't compact things like this into one line, because it makes it harder to set breakpoints when debugging. + if(NS_FAILED(rv)) return rv; In fact the way I would write that part is: + rv = nsLinkableAccessible::GetState(_retval); + if (NS_SUCCEEDED(rv) && IsALink()) { + *aState |= STATE_FOCUSABLE; + } + return rv; +} I think IsAlink() could do away with the temporary nsCOMPtr<nsIContent> and just use mLinkContent from the start
Attachment #187126 -
Flags: review?(aaronleventhal) → review-
Assignee | ||
Comment 15•19 years ago
|
||
Attachment #187126 -
Attachment is obsolete: true
Attachment #187208 -
Flags: review?(aaronleventhal)
Reporter | ||
Comment 16•19 years ago
|
||
Comment on attachment 187208 [details] [diff] [review] Includes missing XBL, fixes nits, simplifies IsALink +nsAccessibilityService::CreateXULLinkAccessible(nsIDOMNode *aNode, nsIAccessible **_retval) Change _retval to aAccessible or something + // should there be a third case where it becomes just text? I'd say no, so jsut remove that comment. BTW, the way to write temporary comments in the code is something like: // XXX Should we be doing blah instead? It might be better because blah blah. People can search on the XXX's so it's better for guys who just like to clean things up. Anyway, that's the custom :) Looks like I may have made a mistake when I said to use mLinkContent, sorry :/ Either go back to the old method or set mLinkContent = nsnull when there is no href attribute. Otherwise the second call to IsALink() will just see that mLinkContent is not null and return true. Oops. Fix those things and r=me
Attachment #187208 -
Flags: review?(aaronleventhal) → review+
Assignee | ||
Comment 17•19 years ago
|
||
Attachment #187208 -
Attachment is obsolete: true
Attachment #187219 -
Flags: review?(aaronleventhal)
Reporter | ||
Updated•19 years ago
|
Attachment #187219 -
Flags: review?(aaronleventhal) → review+
Attachment #187219 -
Flags: superreview?(neil.parkwaycc.co.uk)
Comment 18•19 years ago
|
||
Comment on attachment 187219 [details] [diff] [review] Removes temp comment, fixes mLinkContent always non-null >Index: toolkit/content/widgets/text.xml >=================================================================== >+ <handler event="click" action="if (this.disabled) return; >+ var href = this.getAttribute('href'); >+ if (href) { >+ open(href); >+ } >+ " /> Why not use the block style, like at http://lxr.mozilla.org/mozilla/source/browser/base/content/search.xml#360 ? Makes it clearer, and most other code uses it for more than one or two lines.
Assignee | ||
Comment 19•19 years ago
|
||
Attachment #187219 -
Attachment is obsolete: true
Attachment #187856 -
Flags: superreview?(hyatt)
Attachment #187219 -
Flags: superreview?(neil.parkwaycc.co.uk)
Comment 20•19 years ago
|
||
Hyatt isn't currently reviewing any Mozilla stuff. Neil or Mike Connor are probably better choices for Toolkit reviews.
Attachment #187856 -
Flags: superreview?(hyatt) → superreview?(mconnor)
Reporter | ||
Comment 21•19 years ago
|
||
(In reply to comment #20) > Hyatt isn't currently reviewing any Mozilla stuff. Neil or Mike Connor are > probably better choices for Toolkit reviews. We should find someone to update the super reviewers page on mozilla.org so it is a bit more accurate.
Comment 22•19 years ago
|
||
Comment on attachment 187856 [details] [diff] [review] Pretties up click handler, otherwise same as last r=me on the toolkit bits, but a real SR needs to happen for the rest of this.
Reporter | ||
Comment 23•19 years ago
|
||
Comment on attachment 187856 [details] [diff] [review] Pretties up click handler, otherwise same as last This one has r=aaronlev for the accessibility module changes, and r=mconnor for the toolkit changes. We just need sr= for the accessibility module changes now.
Attachment #187856 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #187856 -
Flags: superreview?(mconnor)
Attachment #187856 -
Flags: review+
Attachment #187856 -
Flags: review?(mconnor)
Comment 24•19 years ago
|
||
Comment on attachment 187856 [details] [diff] [review] Pretties up click handler, otherwise same as last additional note on this: >+ <handler event="click"> >+ <![CDATA[ >+ if (this.disabled) return; >+ var href = this.getAttribute('href'); >+ if (href) { >+ open(href); >+ } prevailing style in toolkit doesn't use return on the same line. Unnecessary brackets are generally wrong too. if (this.disabled) return; var href = this.getAttribute('href'); if (href) open(href);
Attachment #187856 -
Flags: review?(mconnor) → review+
Comment 25•19 years ago
|
||
Comment on attachment 187856 [details] [diff] [review] Pretties up click handler, otherwise same as last >+PRBool nsXULLinkAccessible::IsALink() >+{ >+ // use the cached answer if it exists >+ if (mIsALinkCached) { >+ return mLinkContent ? PR_TRUE: PR_FALSE; >+ } >+ // indicate the test result is cached >+ mIsALinkCached = PR_TRUE; >+ mLinkContent = do_QueryInterface(mDOMNode); >+ if (!mLinkContent) { >+ return PR_FALSE; >+ } >+ // not a link if there is no href attribute >+ if (!mLinkContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::href)) { >+ return PR_FALSE; >+ } >+ // can't detect traversed yet; need ILink interface >+ return PR_TRUE; >+} The base nsLinkableAccessible only sets mLinkContent if the element is a link.
Attachment #187856 -
Flags: superreview?(neil.parkwaycc.co.uk) → superreview-
Assignee | ||
Comment 26•19 years ago
|
||
Uses temp local to store mLinkContent
Attachment #187856 -
Attachment is obsolete: true
Attachment #189189 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #189189 -
Attachment is obsolete: true
Attachment #189189 -
Flags: superreview?(neil.parkwaycc.co.uk)
Assignee | ||
Comment 27•19 years ago
|
||
Attachment #189192 -
Flags: superreview?(neil.parkwaycc.co.uk)
Comment 28•19 years ago
|
||
Comment on attachment 189192 [details] [diff] [review] Changes requested by neil, mconnor >+ return mLinkContent ? PR_TRUE: PR_FALSE; Nit: space needed between PR_TRUE and :
Attachment #189192 -
Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
Reporter | ||
Updated•19 years ago
|
Attachment #189192 -
Flags: approval1.8b4?
Updated•19 years ago
|
Attachment #189192 -
Flags: approval1.8b4? → approval1.8b4+
Reporter | ||
Comment 29•19 years ago
|
||
Thanks Pete! Checking in accessible/src/base/nsAccessibilityAtomList.h; /cvsroot/mozilla/accessible/src/base/nsAccessibilityAtomList.h,v <-- nsAccessibilityAtomList.h new revision: 1.26; previous revision: 1.25 done Checking in accessible/src/base/nsAccessibilityService.cpp; /cvsroot/mozilla/accessible/src/base/nsAccessibilityService.cpp,v <-- nsAccessibilityService.cpp new revision: 1.146; previous revision: 1.145 done Checking in accessible/src/base/nsBaseWidgetAccessible.h; /cvsroot/mozilla/accessible/src/base/nsBaseWidgetAccessible.h,v <-- nsBaseWidgetAccessible.h new revision: 1.14; previous revision: 1.13 done Checking in accessible/src/xul/nsXULTextAccessible.cpp; /cvsroot/mozilla/accessible/src/xul/nsXULTextAccessible.cpp,v <-- nsXULTextAccessible.cpp new revision: 1.16; previous revision: 1.15 done Checking in accessible/src/xul/nsXULTextAccessible.h; /cvsroot/mozilla/accessible/src/xul/nsXULTextAccessible.h,v <-- nsXULTextAccessible.h new revision: 1.13; previous revision: 1.12 done Checking in toolkit/content/widgets/text.xml; /cvsroot/mozilla/toolkit/content/widgets/text.xml,v <-- text.xml new revision: 1.14; previous revision: 1.13 done Checking in accessible/public/nsIAccessibilityService.idl; /cvsroot/mozilla/accessible/public/nsIAccessibilityService.idl,v <-- nsIAccessibilityService.idl new revision: 1.49; previous revision: 1.48 done
Assignee: aaronleventhal → parente
Reporter | ||
Comment 30•19 years ago
|
||
Comment 31•19 years ago
|
||
Comment on attachment 189192 [details] [diff] [review] Changes requested by neil, mconnor >+ open(href); I was racking my brains trying to work out why I was suspicious of this. I've just remembered :-/ 1. This might not work in modal dialogs. As I recall, modal dialogs can only open modal dialogs. We had issues trying to open Help from a dialog's Help button. 2. This might not work in Thunderbird, or it might open the wrong sort of window altogether.
Reporter | ||
Comment 32•19 years ago
|
||
(In reply to comment #31) > (From update of attachment 189192 [details] [diff] [review] [edit]) > >+ open(href); > I was racking my brains trying to work out why I was suspicious of this. I've > just remembered :-/ So override onclick in the capturing phase and do event.preventDefault() in it in those cases. We need some kind of decent default behavior for links.
Reporter | ||
Comment 33•19 years ago
|
||
This was checked in already.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 34•19 years ago
|
||
(In reply to comment #32) > (In reply to comment #31) > > (From update of attachment 189192 [details] [diff] [review] [edit] [edit]) > > >+ open(href); > > I was racking my brains trying to work out why I was suspicious of this. I've > > just remembered :-/ > > So override onclick in the capturing phase and do event.preventDefault() in it > in those cases. We need some kind of decent default behavior for links. > This doesn't work (probably becuase it's too late to preventDefault, i'm not sure), and, FYI, it's indeed very broken in modal dialogs. >
Comment 35•5 years ago
|
||
Keywords: sec508
You need to log in
before you can comment on or make changes to this bug.
Description
•