The SLDS docs describe:
Lookups allow the user to have dual keyboard focus: while focus in the
input search field, the user can type text into the field and
simultaneously use arrow keys to navigate up and down the results
list.
However, for the life of me I cannot get this to work.
The question is: Do you have to do all the JS work yourself thus the statement above is false since it seems to state that it just happens.
A bit off topic but if someone has a link or canned JS to start this it would be great. (Not asking anyone to write is but if it is out there it sure would help a lot of people I would think)
Link do Doc: https://lightningdesignsystem.com/components/lookups/#flavor-advanced-modal – Section Accessability
MRR:
May be some artifacts in here but it should display at least
<div class="slds-form-element">
<label class="slds-form-element__label" for="plan_searchInput">Lookup Plan</label>
<div class="slds-form-element__control slds-input-has-icon slds-input-has-icon--right">
<input id="plan_searchInput" class="slds-input" type="text"
placeholder="Enter Plan Name"
aria-autocomplete="list"
autocomplete="off" role="combobox"
aria-expanded="true" aria-activedescendant="lookup-option-410"
/>
</div>
</div>
<div class="slds-lookup__menu" role="listbox" id="plan_results" style="display: block;">
<!--Search Results UL-->
<ul class="slds-lookup__list" role="presentation" id="plan_results_ul"
style="max-height: 60px;">
<li role="presentation">
<span class="slds-lookup__item-action slds-lookup__item-action--label" id="lookup-option-409" role="option">
<span class="slds-truncate">item 1</span>
</span>
</li>
<li role="presentation">
<span class="slds-lookup__item-action slds-lookup__item-action--label" id="lookup-option-410" role="option">
<span class="slds-truncate">item 2</span>
</span>
</li>
<li role="presentation">
<span class="slds-lookup__item-action slds-lookup__item-action--label" id="lookup-option-411" role="option">
<span class="slds-truncate">item 3</span>
</span>
</li>
</ul>
</div>
</div>
Best Answer
Ok, So I have been working with this for a few days now and have built a component that can handle autocomplete, arrow up and down, highlighting, scrolling in the list, selections, enter key, etc. Posting my current solution here that others may find useful as all the examples out there did not work very well for me or had their own quirks like arrow keys not working etc.
Keep in mind I am no JS developer so it may or may not be rough but for now it works.
Component allows for search of Name field by default but you can pass in additional fields and add a replaceable subtext to display in the search results for example instead of showing just "John Doe" you can show "John Doe (Bank of America)" to provide more context to the user
Note This page is using a VF template that wraps the SLDS requirements for VF and includes the jQuery library and the SLDS CSS file. You can adjust the page to pop it in your own template or page with similar stuff
Visualforce Component
JavaScript Code
Visualforce Remoteing
Example Containing Page (usage not requiring a VF controller)
The page shows an example of how to use the above. The page will rerender the post_processing to show that what was selected is actually updated in the parent page
Disclaimer Now, there are some bad practices in here and that is what I will be working on next but for now this works, and I believe works well.
Starting out
Autocomplete on type with the subtext, part in ( ), populated Default accounts in DE org have the entire address in the BillingStreet by default which is why the entire address is showing for the street.
Using arrow key to navigate
Console output to show parent page updated field with value selected