JSFiddle - React, Tailwind, and code Playground

HTML

<div data-bind="visible: !boolSwitch()">
    <input type="text" id="focusinput" />
</div>
<input type="checkbox" data-bind="checked: boolSwitch" />

JavaScript

var viewModel = function() {
  var self = this;  
    
    self.boolSwitch = ko.observable(true);
    
    return self;
};

var viewModelInstance = viewModel();

ko.applyBindings(viewModelInstance);

viewModelInstance.boolSwitch.subscribe(function(val) {
    if(!val) {
        console.log('changed');
        document.getElementById('focusinput').focus();
    }    
});