I want to access the search view’s isVisible property, how would I do that?
I’m trying to determine if the following view is currently visible so I can handle a second CTRL + F call properly…
Then again, maybe I’m going about this the wrong way… (as I could do it in jQuery, but I recall a recent conversation with @eviltrout about utilizing Ember/Controllers/Views for the shortcuts instead of selectors on the page) so feel free to point me in the right direction too
Awesome. Thank you! I knew I was going up the wrong code path yesterday evening trying to figure out how to do this… I kept looking in the search controller, search views, etc and then ended up in the Discourse.View, which ultimately extended the Ember.View, so I knew I was missing something.
Cool, I’ll be able to move forward with that request later today then!
What I would suggest is adding a method to the search controller for toggling the search.
And rather than implementing showSearch in the Keyboard code as a click on an element, it would instead call that method. Let the search controller be concerned over whether it’s visible or not and needs to hide, etc.
(BTW using the container is generally bad but it’s better than clicking elements in this case. And if we restrict it to just sending the odd signal it makes it easier for refactoring later)
The problem is, I can’t just leave it to the controller for this case, as I need to stop the return false and permit the shortcut to also pass through to the browser to get its native binding executed. So, I have to have a way that gives me feedback so I know if return false is necessary (it is the first call to the binding), or if it should be return true (it is the second call to the binding – to close the search and show the native find control).
It is getting more complicated and might not be a good attempt for me at this stage…