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

Suggestions will hide when input combined character on IE #388

Merged
merged 2 commits into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Autosuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ export default class Autosuggest extends Component {
break;

case 'Enter': {
// Ignore enter of combined character
if (event.keyCode === 229) break;

const highlightedSuggestion = this.getHighlightedSuggestion();

if (isOpen && !alwaysRenderSuggestions) {
Expand Down
6 changes: 6 additions & 0 deletions test/always-render-suggestions/AutosuggestApp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
blurInput,
clickEscape,
clickEnter,
clickCombinedCharacterEnter,
clickDown,
clickUp,
focusAndSetInputValue
Expand Down Expand Up @@ -106,6 +107,11 @@ describe('Autosuggest with alwaysRenderSuggestions={true}', () => {
clickEnter();
expectSuggestions(['Perl', 'PHP', 'Python']);
});

it('should not hide suggestions if enter event for combined character', () => {
clickCombinedCharacterEnter();
expectSuggestions(['Perl', 'PHP', 'Python']);
});
});

describe('when pressing Escape', () => {
Expand Down
5 changes: 5 additions & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ export const clickEnter = () => {
clock.tick(1);
};

export const clickCombinedCharacterEnter = () => {
Simulate.keyDown(input, { key: 'Enter', keyCode: 229 });
clock.tick(1);
};

export const clickDown = (count = 1) => {
for (let i = 0; i < count; i++) {
Simulate.keyDown(input, { key: 'ArrowDown' });
Expand Down