Skip to content

Introduce wrap option to disable wraping if set to false#2

Closed
andysprout wants to merge 2 commits intomoroshko:masterfrom
andysprout:master
Closed

Introduce wrap option to disable wraping if set to false#2
andysprout wants to merge 2 commits intomoroshko:masterfrom
andysprout:master

Conversation

@andysprout
Copy link
Copy Markdown

@andysprout andysprout commented May 12, 2016

Required to mimic select behaviour.

I'm currently trying to extend your react-autosuggest component to mimic a select box.

@moroshko
Copy link
Copy Markdown
Owner

Thanks for the PR!

From what I can see, you would like to achieve the following:

  • When the last item is highlighted, and user hits Down, highlight the first item
  • When the first item is highlighted, and user hits Up, highlight the last item

I explicitly avoided this behaviour when implementing react-autosuggest because of the following WAI-ARIA guideline for autocomplete components:

Note that the arrows will wrap through the textbox when the top or bottom of the list is reached. For example, pressing the down arrow when the last choice is highlighted will move focus back to the textbox, pressing down again will move focus to the first item in the list.

Also, I noticed that in a native <select>, when the last item is highlighted, and you hit Down, nothing happens (it doesn't wrap).

Do you have any accessibility guidelines that you follow while implementing the mentioned select box? Do you know any reputable sites that implement the behaviour you are trying to achieve?

@andysprout
Copy link
Copy Markdown
Author

Thanks for your reply. Sorry I didn't write a more comprehensive description, you are correct about what I am trying to achieve.

I'm definitely not an expert on ARIA, so thanks for pointing me at the correct section. It's probably more correct to not wrap the highlighted suggestion. What do you think about changing the option from allowNull to wrap and just stopping when the user gets to the start or end of the data?

I really like react-autosuggest, the theming and aria compliance are much better than all the select libraries I have found. I hope to have something working today.

@andysprout andysprout changed the title Introduce allowNull option to automatically wrap if set to false Introduce wrap option to disable wraping if set to false May 13, 2016
@moroshko
Copy link
Copy Markdown
Owner

@andysprout Sorry, I'll pass on this one. I feel like extending react-autosuggest to be a select box is beyond the scope of that project. I really appreciate your time and effort. Next time, it's probably a good idea to start a conversation in an issue first.

@moroshko moroshko closed this Jul 21, 2016
@andysprout
Copy link
Copy Markdown
Author

No worries, at first I thought it was going to be a small change, but as I carried on the change required grew and grew. This was for a project my team needed anyway so we're continuing to use our fork build for now.

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

Successfully merging this pull request may close these issues.

2 participants