title: How to set focus of input after computed has been updated
body: <p>I have table/grid that shows devices based on their type. Whenever the dropdown changes, the table should update to show the correct devices. To do this i have a computed that filters the devices by type and adds a new blank row to the table/grid.</p>
  
  <p>Here's the html:
      </p>
  
  <pre><code>&lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;!--Row Number--&gt;&lt;/th&gt;
              &lt;th&gt;Serial No.&lt;/th&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;&lt;!--Delete Button--&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody data-bind="foreach: filteredDevices"&gt;
          &lt;tr&gt;
              &lt;td data-bind="text: $index() + 1"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input data-bind="value: serial, event: { change: ($parent.filteredDevices().length == $index() + 1) ? $parent.addDevice : '' }" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input data-bind="value: name, event: { change: ($parent.filteredDevices().length == $index() + 1) ? $parent.addDevice : '' }" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;button type="button" data-bind="visible: $parent.filteredDevices().length != $index() + 1, click: $parent.deleteDevice"&gt;Delete&lt;/button&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Knockout code:</p>
  
  <pre><code>var DevicesViewModel = function () {
      var self = this;
  
      self.devices = ko.observableArray([{ name: 'test1', serial: 'test1', type: 'type1' },{ name: 'test2', serial: 'test2', type: 'type2' }]);
      self.selectedDeviceType = ko.observable("type1");
  
      self.deviceTypes = ko.observableArray([
          { value: 'type1', name: 'Type 1' },
          { value: 'type2', name: 'Type 2' }
      ]);
  
      self.addDevice = function (data) {
          self.devices.push({ name: data.name, serial: data.serial, type: data.type });
      };
  
      self.deleteDevice = function (device) {
          self.devices.remove(device);
      };
  
      self.filteredDevices = ko.computed(function () {
          var arr = ko.utils.arrayFilter(self.devices(), function (device) {
              return device.type == self.selectedDeviceType();
          });
  
          arr.push({ name: null, serial: null, type: self.selectedDeviceType() });
  
          return arr;
      });
  };
  
  ko.applyBindings(new DevicesViewModel());
  </code></pre>
  
  <p>Here is the fiddle for it: <a href="https://jsfiddle.net/wa9108bf/" rel="nofollow noreferrer">https://jsfiddle.net/wa9108bf/</a></p>
  
  <p>If you tab through the grid initially, everything works fine. However if you type something into the first input of the last row and tab over, the focus gets lost. I'm guessing this happens because the computed is updated and the table is rendered again with the new computed array which know nothing about the focus. Is there a way to get the functionality I want?</p>