Closed Bug 1005268 Opened 6 years ago Closed 1 year ago

element.type returns "text" for input type month|week|datetime|datetime-local

Categories

(Core :: Layout: Form Controls, defect)

29 Branch
All
Android
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: markus.popp, Assigned: robwu)

References

(Depends on 1 open bug)

Details

Attachments

(2 files)

Input types month, week, datetime and datetime-local are supported on Firefox Android, including UI. Nevertheless, the element's type value returns "text" rather than the corresponding input type. Because of this, Firefox on Android misses out many points on various tests, like html5test.com and Modernizr.

I created a JSFiddle which extracts the test code of html5test.com:

http://jsfiddle.net/mpopp75/YWwC6/

On current Firefox/Android versions, this should return true.
Where does this support live, exactly?  Who added it?

kInputTypeTable doesn't contain those values (which is why .type doesn't returne them), so core Gecko knows nothing about this support.
Looks like they're hacked in directly in the Android UI (see PromptInput.java)

In particular, I seriously doubt we do correct constraint validation for those input types, since that lives in core.  All we have on Android is using a slightly better keyboard/UI, not actual support for these input types.
Blocks: html5test
Depends on: datetime
Depends on: 888316
Depends on: 888324
Depends on: 888328
Depends on: 888331
No longer depends on: 1307384
Starting with version 57 this bug now also is in the desktop version of firefox, this breaks workarounds for the still not implmented html5 input types. See the webshim bug: -> https://github.com/aFarkas/webshim/issues/592
> this bug now also is in the desktop version of firefox

The desktop version of Firefox doesn't support the month/week/datetime/datetime-local types, so returning "text" is correct there.  57 didn't change anything in this regard.

The "date" and "time" types are supported, and report "date" and "time" respectively from .type.

So I don't see what the issue is on desktop: the .type correctly indicates support.
> The "date" and "time" types are supported, and report "date" and "time" respectively from .type.

As of 57, that is.  They were not supported on desktop in 56.
Just done a view tests which type is reported

- Firefox 52.6.0ESR -> text
- Firefox 53.0.3 -> text
- Firefox 54.0.1 -> text
- Firefox 55.0.3 -> text
- Firefox 56.0.2 -> text
- Firefox 57.0.4 -> text
- Firefox 58.0.2 -> text

You are right, it reported text as type in the previous versions
`<input type=datetime>` was dropped from the spec many years ago,
and is not supported by the platform. To JS code, it looks like a
regular text input box.

With removed support for "datetime" inputs, we can also fix a bug in the
InputWidgetHelper. Due to the use of getAttribute, if the attribute
value was capitalized, then the special date/time picker UI would not be
shown. This is corrected by using the "type" property instead.

I verified on Android Nougat that all other input types (date,
datetime-local, week, month, time) still work as intended.
The above patch depends on bug 1498787, because the patch modifies code that I touched in that other bug.
Assignee: nobody → rob
Status: NEW → ASSIGNED
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/f992e8a4e7e6
Remove "datetime" UI from Fennec and fix capitalization issue r=jchen
https://hg.mozilla.org/mozilla-central/rev/f992e8a4e7e6
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.