Closed Bug 316616 Opened 19 years ago Closed 19 years ago

a11y: pressing first key of item in select should select item

Categories

(Core Graveyard :: XForms, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aaronr, Assigned: doronr)

References

Details

(Keywords: fixed1.8.0.4, fixed1.8.1)

Attachments

(3 files, 1 obsolete file)

as per http://www.mozilla.org/access/toolkit-checklist "Typing letter or several letters to navigate (same letter goes to each item starting with that, different letters go to first item starting with that entire string)". Like for XHTML select with @multiple='true', this should work on a xf:select.
Attached file testcase (deleted) —
Attached patch le patch (obsolete) (deleted) — Splinter Review
The issue was we were cloning the full <label/>, which confuses html:select it seems. So cloning the children directly makes it work.
Attachment #203829 - Flags: review?(aaronr)
Attached file modified testcase (deleted) —
The patch breaks this testcase, where the label of the first item can be changed using <xforms:input>
(In reply to comment #3) > Created an attachment (id=203833) [edit] > modified testcase > > The patch breaks this testcase, where the label of the first item can be > changed using <xforms:input> > Nice catch. So, in that case we have to clone label and the find as you type part of html:option will break. Should I special case ref/bind usage and keep the existing behavior? That would mean that some items won't work with fayt.
Attachment #203829 - Flags: review?(aaronr)
Attached patch Fix the issue (deleted) — Splinter Review
If there is a bound node, get the text value, else clone the contents.
Attachment #203829 - Attachment is obsolete: true
Attachment #207669 - Flags: review?
Attachment #207669 - Flags: review? → review?(smaug)
Attachment #207669 - Flags: review?(aaronr)
Attachment #207669 - Flags: review?(smaug) → review+
Comment on attachment 207669 [details] [diff] [review] Fix the issue >Index: extensions/xforms/resources/content/select.xml >=================================================================== >RCS file: /cvsroot/mozilla/extensions/xforms/resources/content/select.xml,v >retrieving revision 1.11 >diff -u -r1.11 select.xml >--- extensions/xforms/resources/content/select.xml 29 Nov 2005 22:08:59 -0000 1.11 >+++ extensions/xforms/resources/content/select.xml 5 Jan 2006 23:03:56 -0000 >@@ -105,7 +105,7 @@ > <getter> > if (!this._uiElement) { > this._uiElement = >- document.getAnonymousElementByAttribute(this, "anonid", "select");; >+ document.getAnonymousElementByAttribute(this, "anonid", "select"); > } > > return this._uiElement; >@@ -213,13 +213,13 @@ > // "". > var value = ""; > var accessValue = this.accessors.getValue(); >- >+ > if (accessValue) > value = accessValue.replace(/\n|\t|\r/g, " "); >- >+ > // get an array of values selected in the bound node > var selectedArray = value.split(" "); >- >+ > // create a hash from the default values so we can store how often > // we encountered them. This allows us to figure out later if any > // were not hit, which requires us to send an event. >@@ -248,10 +248,10 @@ > // replace new line (\n), tabs (\t) and carriage returns (\r) > // with " ". > var value = string.replace(/\n|\t|\r/g, " "); >- >+ > // get an array of values selected in the bound node > var selectedArray = value.split(" "); >- >+ > // create a hash from the default values so we can store how > // often we encountered them. This allows us to figure out > // later if any were not hit, which requires us to send an >@@ -349,8 +349,6 @@ > } > } > >- >- > return true; > ]]> > </body> >@@ -375,10 +373,27 @@ > if (aUseLabelValue) { > option.textContent = aLabel; > } else { >- // label can contain other elements such as html, so we clone it > var label = aControl.getElementsByTagName("label")[0]; >- var newLabel = label.cloneNode(true); >- option.appendChild(newLabel); >+ >+ // We either have a bound node and get it's content, or we >+ // clone the contents of the label element >+ if (label.accessors.hasBoundNode()) { >+ option.textContent = label.accessors.getValue(); >+ } else { >+ var childLength = label.childNodes.length; >+ >+ // text content only? >+ if (childLength == 1 && label.firstChild.nodeType == Node.TEXT_NODE) { >+ option.textContent = label.textContent; >+ } else { >+ // clone all children. We don't simply clone the xforms:label >+ // because xhtml:select will get confused by it and break >+ // find-as-you-type. >+ for (var i = 0; i < childLength; i++) { >+ option.appendChild(label.childNodes[i].cloneNode(true)); >+ } >+ } >+ } > } > > return option; >@@ -546,12 +561,12 @@ > } else { > // if some copyItems were selected by the user prior to the call > // to _getSelectedValues, then we would not have set up >- // _delegateValueCache. Since the node we are bound to can't >+ // _accessorValueCache. Since the node we are bound to can't > // be set by copyItems (its not an ELEMENT_NODE), any copyItems > // in this select would have been deselected during > // _getSelectedValues. Thus, anything in the contentEnvelope at > // this point should just be strings and so we can set >- // delegate.value directly and use _delegateValueCache after all. >+ // delegate.value directly and use _accessorValueCache after all. > > this.accessors.setValue(contentEnvelope.nodeValue); > this._accessorValueCache = contentEnvelope.nodeValue; >@@ -868,10 +883,27 @@ > if (aUseLabelValue) { > labelSpan.textContent = aLabel; > } else { >- // label can contain other elements such as html, so we clone it > var label = aControl.getElementsByTagName("label")[0]; >- var newLabel = label.cloneNode(true); >- labelSpan.appendChild(newLabel); >+ >+ // We either have a bound node and get it's content, or we >+ // clone the contents of the label element >+ if (label.accessors.hasBoundNode()) { >+ labelSpan.textContent = label.accessors.getValue(); >+ } else { >+ var childLength = label.childNodes.length; >+ >+ // text content only? >+ if (childLength == 1 && label.firstChild.nodeType == Node.TEXT_NODE) { >+ labelSpan.textContent = label.textContent; >+ } else { >+ // clone all children. We don't simply clone the xforms:label >+ // because xhtml:select will get confused by it and break >+ // find-as-you-type. >+ for (var i = 0; i < childLength; i++) { >+ labelSpan.appendChild(label.childNodes[i].cloneNode(true)); >+ } >+ } >+ } > } > > var input = document.createElementNS("http://www.w3.org/1999/xhtml",
Attachment #207669 - Flags: review?(aaronr) → review+
checked into trunk.
Status: NEW → ASSIGNED
Whiteboard: xf-to-branch
Blocks: 326556
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Blocks: 332853
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: