Share via


SearchBox.chooseSuggestionOnEnter property

[SearchBox is no longer available for use as of Windows 10. Instead, use AutoSuggestBox. ]

Gets or sets whether the first suggestion is chosen when the user presses Enter.

Syntax

<div 
    data-win-control="WinJS.UI.SearchBox" 
    data-win-options="{ chooseSuggestionOnEnter : value}" >
</div>
var chooseSuggestionOnEnter = searchBox.chooseSuggestionOnEnter;
searchBox.chooseSuggestionOnEnter = chooseSuggestionOnEnter;

Property value

Type: Boolean

true if the first suggestion should be automatically chosen when the user presses Enter; false if the user must explicitly move focus to the first item for Enter to select it. The default value is false.

Remarks

When this property is true, as the user types in the search box, a focus rectangle is drawn on the first search suggestion (if present and no IME composition in progress). Pressing Enter will behave the same as if the user clicked on the focused suggestion, and the down arrow key press will put real focus to the second suggestion and the up arrow key will remove focus.

Requirements

Minimum WinJS version

WinJS 3.0

Namespace

WinJS.UI

See also

SearchBox