discourse/spec/system/page_objects/modals/admin_search.rb
Kris 231b3943d3
UX: simplify admin search, make more accessible (#32733)
This simplifies the admin search and adds some basic accessibility

Simplification: 
* Removes the filters for now, both in the modal and full-screen 
* Removes the link to full-screen from the modal
* Simpler input placeholder text
* Positioned to sit higher on the page, similar to a command palette 

Accessibility: 
* Results (or lack of) announced for screenreaders after query 

Bonus: 
* Makes the modal input sticky on scroll 
* Combined some styles shared between this and the chat menu (modifier +
k) under a `--quick-palette` class



Before:

![image](https://github.com/user-attachments/assets/0af2d741-e870-4ad2-b305-57dc4afc3946)


After:


![image](https://github.com/user-attachments/assets/a8492aed-03c7-4d73-a3d3-ae89834b82bc)

---------

Co-authored-by: Krzysztof Kotlarek <kotlarek.krzysztof@gmail.com>
2025-05-15 16:31:03 +10:00

21 lines
496 B
Ruby

# frozen_string_literal: true
module PageObjects
module Modals
class AdminSearch < PageObjects::Modals::Base
MODAL_SELECTOR = ".admin-search-modal"
def search(query)
find(".admin-search__input-field").fill_in(with: query)
end
def find_result(type, position)
all(".admin-search__result[data-result-type='#{type}']")[position]
end
def input_enter
find(".admin-search__input-field").send_keys(:enter)
end
end
end
end