Search Behavior between Keyboard and Mouse Users is inconsistent


(cpradio) #1

Repro Steps:

  1. Refresh the page (to clear any prior activity to the Search box)
  2. Navigate to the Latest Page for any Category
  3. Click the Search Icon with your Mouse, notice how “Search the “category name” category” is unchecked
  4. Click anywhere on the page to dismiss the Search box
  5. Press the / key to open the Search box via the keyboard
  6. Notice how the “Search the “category name” category” box is checked.

Expected:
The end result is the same between the two options (preferably, the checkbox remains unchecked and must be manually checked – as the button limits your scope and doesn’t include sub-categories)

Actual:
The two methods currently do not behave the same with mouse users having the checkbox unchecked and keyboard users having it checked.


(Jeff Atwood) #2

Interesting, this might actually be a small bug, @sam.


(TechnoBear) #3

My preference would be the opposite - partly because that’s what I’m used to as a keyboarder, but also because I think that if you’re already within a category, the chances are that it’s that category you want to search. Adding a second option to also search sub-categories is a much-needed feature, IMHO.


(cpradio) #4

I don’t have a strong preference either way, but I see it as relatively easy to remove the auto-check from the keyboard shortcut, and less easy to add it on mouse-click.

For altering the keyboard shortcut it is as simple as opening app/assets/javascripts/discourse/lib/keyboard_shortcut.js and comment out on line 156

.set('searchContextEnabled', true);

I’m still trying to figure out how the search button is opened via mouse, so I can look at that logic. :smile:


(cpradio) #5

FYI:
Just realized this applies to all contexts of search, from within category, off a user’s profile page, inside messages, and in a topic.


(Sam Saffron) #6

I think we fixed this a while back, can you flag to reopen if still an issue


(Sam Saffron) #7