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

UInput Component Lacks Proper Handling of compositionstart and compositionend #2713

Open
smile-alive opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working triage

Comments

@smile-alive
Copy link

Environment

Version

v2.18.4

Reproduction

https://stackblitz.com/edit/nuxt-ui-8d9s2j?file=app.vue

Description

The UInput component does not handle compositionstart and compositionend events, resulting in issues for languages that rely on input composition, such as Chinese (e.g., Pinyin input). Vue’s default behavior for v-model on native input elements ensures that updates are delayed until the composition ends, preventing intermediate values from triggering updates. However, the UInput component currently lacks this mechanism, causing inconsistencies with Vue’s default form handling and leading to unexpected behavior during text composition.

Additional context

Image

<template>
	<input v-model="keyword" />
</template>

<script setup>
	const keyword = ref('');

	watchEffect(() => {
		console.log('🚀 ~ watchEffect ~ keyword.value:', keyword.value);
	});
</script>

Image

<template>
	<UInput v-model="keyword" />
</template>

<script setup>
	const keyword = ref('');

	watchEffect(() => {
		console.log('🚀 ~ watchEffect ~ keyword.value:', keyword.value);
	});
</script>

Logs

@smile-alive smile-alive added bug Something isn't working triage labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant