forked from mirrors/gecko-dev
Bug 1485862 - Set correct text-input-type for input[type=number]. r=surkov
This commit is contained in:
parent
dcedbb628b
commit
dd36aade7d
2 changed files with 7 additions and 1 deletions
|
|
@ -307,7 +307,11 @@ HTMLTextFieldAccessible::NativeAttributes()
|
|||
// Expose type for text input elements as it gives some useful context,
|
||||
// especially for mobile.
|
||||
nsAutoString type;
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
|
||||
// In the case of input[type=number], mContent is anonymous and is an
|
||||
// input[type=text]. Getting the root not-anonymous content will give
|
||||
// us the right type. In case of other input types, this returns the same node.
|
||||
nsIContent* content = mContent->FindFirstNonChromeOnlyAccessContent();
|
||||
if (content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType, type);
|
||||
if (!ARIARoleMap() && type.EqualsLiteral("search")) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
|||
testAttrs("search", {"text-input-type": "search"}, true);
|
||||
testAttrs("tel", {"text-input-type": "tel"}, true);
|
||||
testAttrs("url", {"text-input-type": "url"}, true);
|
||||
testAttrs(getAccessible("number").firstChild, {"text-input-type": "number"}, true);
|
||||
|
||||
// ARIA
|
||||
testAttrs("searchbox", {"text-input-type": "search"}, true);
|
||||
|
|
@ -220,6 +221,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
|||
<input id="search" type="search"/>
|
||||
<input id="tel" type="tel"/>
|
||||
<input id="url" type="url"/>
|
||||
<input id="number" type="number"/>
|
||||
<div id="searchbox" role="searchbox"></div>
|
||||
|
||||
<!-- html -->
|
||||
|
|
|
|||
Loading…
Reference in a new issue