Skip to content

Commit 5cbb865

Browse files
committed
Revert "fix(input): DP-173960 handle composition events (#1082)"
This reverts commit ff4a9a6.
1 parent 354b873 commit 5cbb865

File tree

2 files changed

+1
-83
lines changed

2 files changed

+1
-83
lines changed

packages/dialtone-vue/components/input/input.test.js

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -586,77 +586,6 @@ describe('DtInput tests', () => {
586586
});
587587
});
588588

589-
describe('IME Composition Tests', () => {
590-
describe('When type is not a textarea', () => {
591-
it('should not emit input or update:modelValue while composing', async () => {
592-
await nativeInput.trigger('compositionstart');
593-
await nativeInput.trigger('input');
594-
595-
expect(wrapper.emitted().input).toBeUndefined();
596-
expect(wrapper.emitted()['update:modelValue']).toBeUndefined();
597-
});
598-
599-
it('should emit input and update:modelValue after composition ends', async () => {
600-
await nativeInput.trigger('compositionstart');
601-
await nativeInput.trigger('input');
602-
603-
nativeInput.element.value = 'か';
604-
await nativeInput.trigger('compositionend');
605-
await nativeInput.trigger('input');
606-
607-
expect(wrapper.emitted().input[0][0]).toBe('か');
608-
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('か');
609-
});
610-
611-
it('should resume normal emission after composition ends', async () => {
612-
await nativeInput.trigger('compositionstart');
613-
await nativeInput.trigger('input');
614-
await nativeInput.trigger('compositionend');
615-
616-
nativeInput.element.value = 'hello';
617-
await nativeInput.trigger('input');
618-
619-
expect(wrapper.emitted().input[0][0]).toBe('hello');
620-
});
621-
});
622-
623-
describe('When type is a textarea', () => {
624-
beforeEach(() => {
625-
mockProps = { type: 'textarea' };
626-
updateWrapper();
627-
});
628-
629-
it('should not emit input or update:modelValue while composing', async () => {
630-
await nativeTextarea.trigger('compositionstart');
631-
await nativeTextarea.trigger('input');
632-
633-
expect(wrapper.emitted().input).toBeUndefined();
634-
expect(wrapper.emitted()['update:modelValue']).toBeUndefined();
635-
});
636-
637-
it('should emit input and update:modelValue after composition ends', async () => {
638-
await nativeTextarea.trigger('compositionstart');
639-
await nativeTextarea.trigger('input');
640-
641-
nativeTextarea.element.value = 'か';
642-
await nativeTextarea.trigger('compositionend');
643-
await nativeTextarea.trigger('input');
644-
645-
expect(wrapper.emitted().input[0][0]).toBe('か');
646-
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('か');
647-
});
648-
649-
it('should not override textarea value via modelValue watcher while composing', async () => {
650-
nativeTextarea.element.value = 'composing...';
651-
await nativeTextarea.trigger('compositionstart');
652-
653-
await wrapper.setProps({ modelValue: 'external update' });
654-
655-
expect(nativeTextarea.element.value).toBe('composing...');
656-
});
657-
});
658-
});
659-
660589
describe('Extendability Tests', () => {
661590
it('should handle pass through props/attrs', async () => {
662591
expect(nativeInput.attributes()).toMatchObject(baseAttrs);

packages/dialtone-vue/components/input/input.vue

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ export default {
373373
isInvalid: false,
374374
defaultLength: 0,
375375
hasSlotContent,
376-
isComposing: false,
377376
};
378377
},
379378
@@ -409,16 +408,7 @@ export default {
409408
410409
inputListeners () {
411410
return {
412-
compositionstart: () => {
413-
this.isComposing = true;
414-
},
415-
416-
compositionend: () => {
417-
this.isComposing = false;
418-
},
419-
420411
input: async event => {
421-
if (this.isComposing) return;
422412
let val = event.target.value;
423413
if (this.type === INPUT_TYPES.FILE) {
424414
const files = Array.from(event.target.files);
@@ -544,8 +534,7 @@ export default {
544534
}
545535
546536
// Set textarea value programmatically to avoid attribute binding
547-
// Skip during IME composition to avoid interrupting in-progress input
548-
if (this.isTextarea && this.$refs.input && this.$refs.input.value !== newValue && !this.isComposing) {
537+
if (this.isTextarea && this.$refs.input && this.$refs.input.value !== newValue) {
549538
this.$refs.input.value = newValue;
550539
}
551540
},

0 commit comments

Comments
 (0)