Fixing search fields

The behavior of the taxon search field on SEINet has been a source of irritation for a while. The per-usage irritation is very low, but as a web page that I use frequently it does add up. Basically, the behavior I desire from the taxon search field is: I type a taxon name, I hit enter, records are queried by the taxon name I typed. The actual behavior of the taxon search field is fairly complicated and context-dependent. There is only one consistent way to execute a query based on the text you’ve typed into it: type the taxon name, left-click with the cursor outside the field, and hit ‘enter’. This is inconvenient because it forces frequent keyboard to mouse (well, trackball) transitions. With the keyboard alone, typing the taxon name and hitting ‘enter’, typing the taxon name and hitting ‘enter’ twice, and typing the taxon name and hitting ‘escape’ then ‘enter’ all work some but not all of the time.

Tyler Compton pointed me towards the solution to this, which I write here for my own future reference, since this blog happens to be a convenient place to simply store text in a way that is consistently findable across devices. In Chrome: install the ‘Codify’ extension, which allows you to enter a bit of JavaScript that the browser will run whenever a specified URL is loaded; enter the following for URLs that contain ‘swbiodiversity.org’:

const listItem = document.getElementById("taxa");
const newItem = document.createElement("taxa");
newItem.innerHTML = '<input type="text" id="taxa" size="60" name="taxa" value="" title="">';
listItem.parentNode.replaceChild(newItem, listItem);

On the to-do list: doing the same for taxon search fields on iNaturalist… which I’m expecting will be more difficult.

Leave a Reply