Compartir a través de


SearchBox.focusOnKeyboardInput property

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

Gets or sets a value that specifies whether the search box automatically receives focus when the user types into the app window. When focus is automatically redirected to the search box, it triggers the onreceivingfocusonkeyboardinput event.

Syntax

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

Property value

Type: Boolean

true if the search box automatically receives focus when the user types into the app window; otherwise, false. The default value is false.

Remarks

While this property is true, input on the current thread will be intercepted and redirected to the search box. Only textual input triggers the search box to focus. The caller will continue to receive non-text keys, such as arrows, tab, and so on. This setting does not affect Win, Ctrl, Alt key combinations (except for Ctrl-V for paste). If you to so something more than just redirect focus to the search box handle the onreceivingfocusonkeyboardinput event. If you enable this property, be sure to disable it if the user moves focus to another editable field in the app.

Requirements

Minimum WinJS version

WinJS 3.0

Namespace

WinJS.UI

See also

SearchBox

onreceivingfocusonkeyboardinput