diff --git a/src/Mentions.tsx b/src/Mentions.tsx index b774bad..668b535 100644 --- a/src/Mentions.tsx +++ b/src/Mentions.tsx @@ -391,10 +391,13 @@ const InternalMentions = forwardRef( const matchOption = !!getOptions(nextMeasureText).length; if (validateMeasure) { + // adding AltGraph also fort azert keyboard if ( key === nextMeasurePrefix || key === 'Shift' || which === KeyCode.ALT || + key === 'AltGraph' || + mergedMeasuring || (nextMeasureText !== mergedMeasureText && matchOption) ) { diff --git a/tests/FullProcess.spec.tsx b/tests/FullProcess.spec.tsx index 6b20d37..b202fb9 100644 --- a/tests/FullProcess.spec.tsx +++ b/tests/FullProcess.spec.tsx @@ -88,6 +88,26 @@ describe('Full Process', () => { expect(onChange).toBeCalledWith('1 @bamboo 2'); }); + it('azerty Keyboards ', () => { + const onChange = jest.fn(); + const { container } = createMentions({ onChange }); + simulateInput(container, '@'); + + // keyCode for ALTGR + fireEvent.keyUp(container.querySelector('textarea'), { + keyCode: 'AltGraph', + which: 225, + }); + expectMeasuring(container); + + fireEvent.keyDown(container.querySelector('textarea'), { + keyCode: KeyCode.ENTER, + which: KeyCode.ENTER, + }); + + expect(onChange).toBeCalledWith('@bamboo '); + }); + it('reuse typed text', () => { const onChange = jest.fn(); const { container } = createMentions({ onChange });