I have a text input field on a liveview to filter content on the page:
<form phx-change="search"><input type="text" name="query" value="<%= @query %>" placeholder="Search..." /></form>
This input is used to filter a listing of stocks by their symbol. It works fine for filtering content, but I would like to add detection on the enter/return key to automatically navigate to a different page/liveview to show the details of the stock (currently, a user has to click on a “Show” link in the table of filtered content).
Is there a way to do this in liveviews, or do I need to add some js to the page to detect a CR key press in the input? I suspect phx-window-keyup might be useful, but I’m not clear where or how I should use it.