Skip to content

PB-396: Updated search bar e2e tests#786

Merged
ltshb merged 6 commits intodevelopfrom
bug-PB-396-search-focus
Apr 15, 2024
Merged

PB-396: Updated search bar e2e tests#786
ltshb merged 6 commits intodevelopfrom
bug-PB-396-search-focus

Conversation

@ltshb
Copy link
Contributor

@ltshb ltshb commented Apr 15, 2024

When clicking on a search bar result make sure to set the focus back on the search bar, so the user can quickly edit the search if needed.

Test link

@github-actions github-actions bot added the bug label Apr 15, 2024
@ltshb ltshb requested review from LukasJoss and ltkum April 15, 2024 13:29
@cypress
Copy link

cypress bot commented Apr 15, 2024

Passing run #1751 ↗︎

0 160 19 0 Flakiness 0

Details:

PB-396: Updated search bar e2e tests
Project: web-mapviewer Commit: 7e0734446d
Status: Passed Duration: 04:50 💡
Started: Apr 15, 2024 2:46 PM Ended: Apr 15, 2024 2:51 PM

Review all test suite changes for PR #786 ↗︎

@focus="onSearchInputFocus"
@keydown.down.prevent="goToFirstResult"
@keydown.esc.prevent="closeSearchResults"
@keydown.esc.prevent="toggleResults"
Copy link
Contributor

@LukasJoss LukasJoss Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The escape toggle is only working when focus is on the search bar and not when it is focused on a search result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I know but this would make the code a bit more complicated as we would need to pass the event up a few hierarchy and we would also need to correctly manage focus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LukasJoss Actually on old viewer the ESC was clearing the input which make more sense what do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the toggle but its up to you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok let be the toggle, chatgpt answer on that

In keyboard navigation in an input text field what is the most common action triggered by ESC ?
ChatGPT
In keyboard navigation within an input text field, pressing the ESC key commonly triggers the action of canceling or closing the current operation or modal window associated with the input field.

For example:

If the input field is part of a search bar or a dropdown menu, pressing ESC might close the dropdown or cancel the search operation.
If the input field is within a modal window, pressing ESC might close the modal and discard any changes made in the input field.
Overall, the ESC key is often used as a convenient way for users to dismiss or cancel ongoing actions or interactions related to input fields.

ltshb added 6 commits April 15, 2024 16:35
When entering in the search bar regex special characters the search bar could
crash especially when entering `(` or `)`.
When closing the search bar result we focus on the input in order to be able
to directly change the input again. When selecting a result entry we then
close the results but also focus on the search input.

Now the ESC key is a toggling result and when pressing enter on the search
input we jump to the first result (opening the result if needed)
During e2e tests of the search bar, the console had errors due to invalid
search layer mocking response.
When removing the swisssearch from the url or when removing its value, a null
value was set in the store which make a crash (happened during e2e tests).

Now we are using the parameter default value
The layer parameter in this case is a string and not an object
@ltshb ltshb force-pushed the bug-PB-396-search-focus branch from 3c8b59b to 7e07344 Compare April 15, 2024 14:41
@ltshb ltshb merged commit f55fc0a into develop Apr 15, 2024
@ltshb ltshb deleted the bug-PB-396-search-focus branch April 15, 2024 14:53
@cypress cypress bot mentioned this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants