define(["layoutManager","events","require"],function(layoutManager,events,require){"use strict";function onKeyPress(evt){var target=evt.target,tag=target.tagName;if(13===evt.keyCode&&(target.isContentEditable||"INPUT"===tag||"TEXTAREA"===tag)&&!target.readonly&&"checkbox"!==target.type&&"radio"!==target.type&&"file"!==target.type&&"range"!==target.type&&function(elem){for(;elem;){if(elem.getAttribute&&"false"===elem.getAttribute("data-keyboard"))return;elem=elem.parentNode}return 1}(target)){var label,labelledBy,options={field:target};return target.id&&(label=document.querySelector("label[for='"+target.id+"']")),label||(labelledBy=target.getAttribute("aria-labelledby"))&&(label=document.querySelector("#"+labelledBy)),label&&(options.label=label.innerHTML),function(options){require(["./keyboard"]).then(function(responses){return responses[0].show(options)})}(options),evt.preventDefault(),!1}}function resetEvent(){document.removeEventListener("keypress",onKeyPress,!0),layoutManager.tv&&document.addEventListener("keypress",onKeyPress,!0)}resetEvent(),events.on(layoutManager,"modechange",resetEvent)});