Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextField component file type setting in Safari 10.0 #14727

Closed
mykehsd opened this issue Dec 16, 2016 · 5 comments
Closed

TextField component file type setting in Safari 10.0 #14727

mykehsd opened this issue Dec 16, 2016 · 5 comments

Comments

@mykehsd
Copy link

mykehsd commented Dec 16, 2016

Ember version > 2.10
Safari version tested: 10.0.1
Reproducible: Every time -> https://ember-twiddle.com/aa37dcf277451f5954d6ca2d17e16dc6?openFiles=templates.application.hbs%2C
Safari 10.0.1

Issue: When rendering multiple textfield components on a page, only the first type will be allowed on the page
. The set of the test element .type property successfully returns however the type actually doesn't alter the value of the property.

Problem line:

inputTypeTestElement.type = type;

Possible solution: Lowering the scope of inputTypeTestElement to inside the method resolves the problem, but I assume it was scoped for performance reasons.

@mykehsd mykehsd changed the title TextField component type setting in Safari 10.0 TextField component file type setting in Safari 10.0 Dec 16, 2016
@mykehsd
Copy link
Author

mykehsd commented Dec 16, 2016

After more investigation, the problem is isolated to file types. Safari does not allow creating an input type and changing it to "file".

input = document.createElement('input');
input.type = 'text';    // === 'text'
input.type = 'file';     // === 'text'

@pixelhandler
Copy link
Contributor

Seems like a bug, second input for type="file" doesn't work in Safari, but does in Chrome, Firefox and Brave. Also odd that If I switch the order of inputs the file inputs works and so does the search input, https://ember-twiddle.com/529223e54e9ce39150c3366001a42742?openFiles=templates.application.hbs%2C seem that the issue is more of a problem with the file input type

@rwjblue
Copy link
Member

rwjblue commented Dec 16, 2016

screenshot

anon4562 added a commit to anon4562/ember.js that referenced this issue Dec 22, 2016
You cannot create an element and change it's type from * to "file".  

See: emberjs#14727 for more details
@cibernox
Copy link
Contributor

cibernox commented Jan 5, 2017

FWIW, I also found this problem yesterday in emberx-file-input. I PR'ed a workaround by ...not using {{input}} and using a plain <input> (I think there is no good reason to use {{input}} ever again since ember 2.3.1)

For more weirdness, I found that this only happened the first time I rendered the view with the error. If I transitioned somewhere else and then come back it worked again.

@iezer
Copy link
Contributor

iezer commented Feb 9, 2017

I can also reproduce and it does seem to depend on the ordering of the types of input helper invocations. See twiddle I've also seen (possibly related) that with Ember 2.10, {{input type='date'}} does not work on Safari, or PhantomJS. It works in Chrome and Firefox.

CC @jamesarosen.

Serabe pushed a commit to anon4562/ember.js that referenced this issue Jul 19, 2017
You cannot create an element and change it's type from * to "file".  

See: emberjs#14727 for more details
Serabe added a commit to anon4562/ember.js that referenced this issue Jul 19, 2017
Serabe added a commit to anon4562/ember.js that referenced this issue Jul 19, 2017
@locks locks closed this as completed in 388fac5 Jul 24, 2017
rwjblue pushed a commit that referenced this issue Aug 8, 2017
When testing allowed input types, in some versions of Safari the type
cannot be change to `file` if previously set to a different one.

Fixes #14727

(cherry picked from commit 388fac5)
locks added a commit that referenced this issue Aug 16, 2017
# This is the 1st commit message:
typo in comment

# The commit message #2 will be skipped:

#	indent yuidoc comment

# The commit message #3 will be skipped:

#	remove IE8 test

# The commit message #4 will be skipped:

#	remove commented out test

# The commit message #5 will be skipped:

#	use file path and add imports
#
#	Used RFC #176 modules API for imports.
#	Also cleaned up some of the globals-mode usage.

# The commit message #6 will be skipped:

#	clean up more globals style documentation

# The commit message #7 will be skipped:

#	Updates blueprints

# The commit message #8 will be skipped:

#	remove extra type check

# The commit message #9 will be skipped:

#	[BUGFIX beta] Reusing element causes problems in Safari
#
#	When testing allowed input types, in some versions of Safari the type
#	cannot be change to `file` if previously set to a different one.
#
#	Fixes #14727

# The commit message #10 will be skipped:

#	[DOC release]missed code block added

# The commit message #1 will be skipped:

#	[DOC release] Update wait.js - Add missing backticks to code snippet.

# The commit message #2 will be skipped:

#	use safe `toString` for array content in `mixins/array`

# The commit message #3 will be skipped:

#	avoid expanding already expanded property key in computed.sort

# The commit message #4 will be skipped:

#	avoid expanding already expanded property key in reduceMacro/arrayMacro/multiArrayMacro

# The commit message #5 will be skipped:

#	[DOC release] Make `Ember.expandProperties` public

# The commit message #6 will be skipped:

#	reuse meta `arrayContentDidChange`

# The commit message #7 will be skipped:

#	replace `throw` with assertion in `enumerable`

# The commit message #8 will be skipped:

#	[BUGFIX beta] Allow boolean values for current-when
#
#	As the docs say, `A link will be active if current-when is true`.
#	Looks like this might have been broken since 1.13 and #12344
#	did not seem to actually fix this particular bug.
#
#	Related issues:
#
#	- #12512
#	- #12630 (fix was not merged)
#	- #12296

# The commit message #9 will be skipped:

#	remove unused imports

# The commit message #10 will be skipped:

#	[DOC] Improve Ember.isEmpty

# The commit message #1 will be skipped:

#	micro optimization in `enumerable`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants