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

Safari: input placeholder shown below value after update #426

Open
derhuerst opened this issue Mar 13, 2017 · 2 comments
Open

Safari: input placeholder shown below value after update #426

derhuerst opened this issue Mar 13, 2017 · 2 comments

Comments

@derhuerst
Copy link

derhuerst commented Mar 13, 2017

I'm having this issue with Safari 10.0.3 on macOS 10.12.3. I tried Firefox and Chrome and couldn't reproduce it. I'm using virtual-dom@2.1.1.

I'm trying to render an <input> with autocompletion. I listen to keypress events on it to get the value. The issue I'm facing occurs when I update the value of the <input> from '' to some non-empty string.

const h = require('virtual-dom/h')

const completion = (placeholder, value, suggest) =>
	h('input', {
		type: 'text',
		placeholder: placeholder,
		'ev-keypress': (e) => setTimeout(() => {
			suggest(e.target.value)
		}, 1),
		value: query
	})

const render = (state, actions) =>
	h('form', {
		action: '#'
	}, [
		completion('from', state.from.name, actions.suggestFrom),
		completion('to', state.to.name, actions.suggestTo),
		h('button', {
			type: 'button',
			'ev-click': () => actions.search()
		}, 'lets go')
	])

module.exports = render

The (expected) result in Chrome:

chrome

The (unexpected) result in Safari:

safari

I haven't dug into the virtual-dom patching logic, so I can't tell if this is a bug in Safari or in virtual-dom. Thanks for helping out!

@guivr
Copy link

guivr commented Apr 28, 2017

+1

@HopeLyn
Copy link

HopeLyn commented Jul 20, 2017

It seems to be a Safari bug.You can try this demo https://jsbin.com/rogoludahu/edit?html,js,output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants