Page MenuHomePhabricator

List add search button to the categoryseach so there is clickable button for it.
Closed, ResolvedPublic

Description

As part of mobile review T389723. One missing feature was clickable button in category search. Add missing search button to right side of the search bar.

Details

Other Assignee
Nidhicodes

Event Timeline

Hey @Zache, I've added a search button to improve mobile usability.

search_button.jpg (716×1,600 px, 78 KB)

Changes:
Added button in JS: code diff
Responsive CSS: code diff

Elements in searchInputContainer stay inline down to 150px width, then wrap cleanly. I made sure all existing functionality works properly while adding button support.
Please review it and let me know if you'd like any adjustments!

Hey @Shellygarg10, I’d use a real form, both for accessibility and to make the code simpler (including the removal of a basically copy-pasted event handler):

  • $searchInputContainer would be a <form> instead of a <div>;
  • $searchButton would have type: 'submit' instead of type: 'button';
  • the click handler of $searchButton would call .preventDefault() on its first parameter to avoid submitting the form to the server;
  • and the keypress could be removed from $searchInput – with this thing being a form, pressing Enter activates the submit button automatically (but doesn’t activate a button button, which is why its type needs to be changed), so we don’t have to intercept it on our own.

Hey @Tacsipacsi,
Thank you for the guidance! I've implemented the improvements exactly as you suggested. The functionality remains the same.
Javascript Changes :
https://commons.wikimedia.org/w/index.php?title=User%3AShellygarg10%2FGadget-Cat-a-lot.js&diff=1019306175&oldid=1019300452
CSS Changes :
https://commons.wikimedia.org/w/index.php?title=User%3AShellygarg10%2FGadget-Cat-a-lot.css&diff=1015871084&oldid=1015848029 ( no updates here this time )

Please review it when you get a chance.

merged in main code as part of T395770