Closed
Bug 174889
Opened 23 years ago
Closed 18 years ago
Active Accessibility: unable to get keyboard shortcut for Tree Item node
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
People
(Reporter: dsirnapalli, Assigned: surkov)
References
Details
Attachments
(1 file, 5 obsolete files)
|
17.59 KB,
patch
|
sicking
:
approval1.9+
|
Details | Diff | Splinter Review |
Enter the following code in a xul file and open it in Mozilla.
<tree seltype="single" flex="1">
<treecols>
<treecol id="sender" label="Sender" flex="1"/>
<treecol id="subject" label="Subject" flex="2"/>
</treecols>
<treechildren>
<treeitem accesskey="i">
<treerow>
<treecell label="joe@somewhere.com"/>
<treecell label="Top secret plans"/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label="mel@whereever.com"/>
<treecell label="Lets do lunch"/>
</treerow>
</treeitem>
</treechildren>
</tree>
Open Inspect tool. Tab to the tree item node. Watch the keyboard shortcut in
Inspect tool. It shows empty string. It should show "Alt+i".
| Reporter | ||
Comment 2•23 years ago
|
||
hi kyle,
i am able to get accesskey for tree node, treecols node and treecol node. anyway
when i hit the alt+accesskey on the keyboard it doesnot bring focus on to those
nodes. From the xulplanet.com site i found that there is no accesskey attribute
for tree node. but when i use our nsIAccessible api to get the keyboardshortcut
it returns the accesskey. Also i noticed this for other elements. So i dont know
exactly whether tree will support accesskey. if it doesnot support our api
should not return the accesskey even if we put accesskey attribute in the tree tag.
taking...
Jan, we are not going to support accesskey for tree.treecol/treeitem..., right?
Assignee: aaronl → kyle.yuan
Comment 4•21 years ago
|
||
*** Bug 198122 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 5•18 years ago
|
||
I think we shouldn't check @accesskey attribute on element. Instead we should have a method on nsIEventStateManager to check whether there is registered accesskey on the element.
Assignee: zhayupeng → surkov.alexander
| Assignee | ||
Comment 6•18 years ago
|
||
not tested yet
| Assignee | ||
Comment 7•18 years ago
|
||
Attachment #273384 -
Attachment is obsolete: true
Attachment #273543 -
Flags: review?(Olli.Pettay)
| Assignee | ||
Updated•18 years ago
|
Attachment #273543 -
Flags: review?(aaronleventhal)
Comment 8•18 years ago
|
||
Comment on attachment 273543 [details] [diff] [review]
patch2
Evan, do you have time to review this while I'm out of town?
Attachment #273543 -
Flags: review?(aaronleventhal) → review?(Evan.Yan)
Comment 9•18 years ago
|
||
Comment on attachment 273543 [details] [diff] [review]
patch2
This doesn't event compile.
When changing an interface, you should update the IID.
Attachment #273543 -
Flags: review?(Olli.Pettay) → review-
Comment 10•18 years ago
|
||
s/event/even/
Comment 11•18 years ago
|
||
Comment on attachment 273543 [details] [diff] [review]
patch2
Oops, I downloaded the first patch, not this one.
>diff -u -p -8 -r1.82 nsIEventStateManager.h
Update the IID.
>+FindTargetForAccessKey(nsHashKey *aKey, void *aData, void* aClosure)
...
>+ info->mAccessKey = aKey->HashCode();
Because this relies on the implementation of the HashCode(), it might be good
to add an assertion to RegisterAccessKey which checks that HashCode() returns the
same value which is used there to create the hashkey.
>+nsEventStateManager::GetRegisteredAccessKey(nsIContent* aContent,
...
>+ AccessKeyInfo* info = new AccessKeyInfo(aContent);
Couldn't you stack allocate AccessKeyInfo and then pass &info to Enumerate()
How often GetRegisteredAccessKey is called? If there are many accesskeys registered, it isn't
very fast method (O(n)).
| Assignee | ||
Comment 12•18 years ago
|
||
(In reply to comment #11)
> >+nsEventStateManager::GetRegisteredAccessKey(nsIContent* aContent,
> ...
> >+ AccessKeyInfo* info = new AccessKeyInfo(aContent);
>
> Couldn't you stack allocate AccessKeyInfo and then pass &info to Enumerate()
Not sure I got you. How can I do it?
>
> How often GetRegisteredAccessKey is called? If there are many accesskeys
> registered, it isn't
> very fast method (O(n)).
>
It shouldn't be too often. Though if you have an idea how to improve this I can do it.
| Assignee | ||
Comment 13•18 years ago
|
||
Attachment #273543 -
Attachment is obsolete: true
Attachment #273770 -
Flags: review?(Olli.Pettay)
Attachment #273543 -
Flags: review?(Evan.Yan)
Comment 14•18 years ago
|
||
Comment on attachment 273770 [details] [diff] [review]
patch3
>+static PRBool PR_CALLBACK
Not PRBool but PRIntn
>+FindTargetForAccessKey(nsHashKey *aKey, void *aData, void* aClosure)
...
>+ if (aTarget == info->mTarget) {
>+ info->mAccessKey = aKey->HashCode();
>+ return PR_FALSE;
return kHashEnumerateStop;
>+ }
>+
>+ return PR_TRUE;
>+}
return kHashEnumerateNext
See http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsHashtable.h#109
With those, r=me for the content/ changes, assuming that accessibility code doesn't call
GetRegisteredAccessKey all the time.
Attachment #273770 -
Flags: review?(Olli.Pettay) → review+
| Assignee | ||
Comment 15•18 years ago
|
||
Attachment #273770 -
Attachment is obsolete: true
Attachment #273777 -
Flags: review?(ginn.chen)
| Assignee | ||
Updated•18 years ago
|
Attachment #273777 -
Flags: superreview?(jst)
Comment 16•18 years ago
|
||
Comment on attachment 273777 [details] [diff] [review]
patch4
+ if (!key)
return NS_OK;
+
+ nsAutoString accesskey(key);
I'd like to see something like
nsAutoString accesskey(PRUnichar(key));
Attachment #273777 -
Flags: review?(ginn.chen) → review+
| Assignee | ||
Comment 17•18 years ago
|
||
(In reply to comment #16)
> (From update of attachment 273777 [details] [diff] [review])
> + nsAutoString accesskey(key);
>
> I'd like to see something like
> nsAutoString accesskey(PRUnichar(key));
>
Why? Is it char_type for nsAutoString?
Comment 18•18 years ago
|
||
(In reply to comment #17)
> (In reply to comment #16)
> > (From update of attachment 273777 [details] [diff] [review] [details])
> > + nsAutoString accesskey(key);
> >
> > I'd like to see something like
> > nsAutoString accesskey(PRUnichar(key));
> >
>
> Why? Is it char_type for nsAutoString?
>
Just help me understand that "key" is an ASCII char.
PRUnichar equals to PRInt16 or PRInt32.
| Assignee | ||
Comment 19•18 years ago
|
||
(In reply to comment #18)
> > Why? Is it char_type for nsAutoString?
> >
> Just help me understand that "key" is an ASCII char.
> PRUnichar equals to PRInt16 or PRInt32.
>
Ok, I don't mind.
| Assignee | ||
Comment 20•18 years ago
|
||
Johnny, any plans to review this?
Comment 21•18 years ago
|
||
Comment on attachment 273777 [details] [diff] [review]
patch4
Let's try Mats instead. Email him if we don't get a response :)
Attachment #273777 -
Flags: superreview?(jst) → superreview?(mats.palmgren)
Comment 22•18 years ago
|
||
A couple nits:
In nsIEventStateManager.h/cpp: please place the * in the parameter type
consistently, follow the establish style for the file, which in this case
is with the type name.
Reading the documentation for nsIEventStateManager::GetRegisteredAccessKey()
and nsAccUtils::GetAccessKeyFor() - it's unclear to me what will be returned
in case there is no accesskey registered for the content.
Please document it explicitly that aKey=0 and NS_OK is returned in that case.
A couple of questions:
You have changed nsAccessible::GetKeyboardShortcut() so that it now
returns NS_OK when the accesskey is not found (was NS_ERROR_FAILURE).
This makes DOMI list keyboardShortcut="" for every accessible node
that does not have an accesskey registered (previously it was absent).
Is this intentional?
Regarding performance, I think we can prune the number of calls to ESM
by using (in GetKeyboardShortcut()):
if (!content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::accesskey))
return 0;
AFAIK, noone registers an accesskey that doesn't come from that attribute.
This bug is really about the opposite case isn't it? - we have an accesskey
attr but the content chose not to register it for some reason - please
correct me if I misunderstood something.
OS: Windows 2000 → All
Hardware: PC → All
| Assignee | ||
Comment 23•18 years ago
|
||
with mats recommendations
Attachment #273777 -
Attachment is obsolete: true
Attachment #278267 -
Flags: review?(mats.palmgren)
Attachment #273777 -
Flags: superreview?(mats.palmgren)
| Assignee | ||
Comment 24•18 years ago
|
||
(In reply to comment #22)
> This bug is really about the opposite case isn't it? - we have an accesskey
> attr but the content chose not to register it for some reason - please
> correct me if I misunderstood something.
>
you're right.
Status: NEW → ASSIGNED
Comment 25•18 years ago
|
||
Comment on attachment 278267 [details] [diff] [review]
patch5
Index: accessible/src/base/nsAccessibilityUtils.cpp
+ // whether it is presented on the given element to avoid not fast call of
+ // nsIEventStateManager::GetRegisteredAccessKey() method.
s/not fast call of/the slow/
Index: accessible/src/base/nsAccessible.cpp
+nsAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
...
+ if (!key)
return NS_OK;
Please add aAccessKey.Truncate() before the return to clear any
existing value (you don't need it when returning a failure code though).
Index: accessible/src/xul/nsXULMenuAccessible.cpp
if (accesskey.IsEmpty())
return NS_OK;
_retval.Truncate() before the return
Index: content/events/public/nsIEventStateManager.h
+ /**
+ * Get accesskey registered on the given element or 0 if there is no
+ * an accesskey.
s/no an accesskey/none/
Index: content/events/src/nsEventStateManager.cpp
+FindTargetForAccessKey(nsHashKey *aKey, void *aData, void* aClosure)
nsHashKey* and void*
+nsEventStateManager::GetRegisteredAccessKey(nsIContent* aContent,
+ PRUint32 *aKey)
PRUint32*
Index: content/events/src/nsEventStateManager.h
+ NS_IMETHOD GetRegisteredAccessKey(nsIContent* aContent, PRUint32 *aKey);
PRUint32*
r+sr=mats with the above addressed.
Attachment #278267 -
Flags: superreview+
Attachment #278267 -
Flags: review?(mats.palmgren)
Attachment #278267 -
Flags: review+
| Assignee | ||
Updated•18 years ago
|
Attachment #278267 -
Flags: approval1.9?
| Assignee | ||
Comment 26•18 years ago
|
||
(In reply to comment #22)
> A couple of questions:
> You have changed nsAccessible::GetKeyboardShortcut() so that it now
> returns NS_OK when the accesskey is not found (was NS_ERROR_FAILURE).
> This makes DOMI list keyboardShortcut="" for every accessible node
> that does not have an accesskey registered (previously it was absent).
> Is this intentional?
Sorry, forgot to answer. Yes I did this intentional. We should return NS_OK when there is not error actually. It makes the js life easier. It's another issue with DOMi. I think I should file bug for this for investigation.
| Assignee | ||
Comment 27•18 years ago
|
||
mats comments are addressed
Attachment #278267 -
Attachment is obsolete: true
Attachment #278549 -
Flags: approval1.9?
Attachment #278267 -
Flags: approval1.9?
Attachment #278549 -
Flags: approval1.9? → approval1.9+
| Assignee | ||
Comment 28•18 years ago
|
||
checked in
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 29•18 years ago
|
||
I think this probably caused bug 394501.
You need to log in
before you can comment on or make changes to this bug.
Description
•