hplush / slowreader

Web app to combine feeds from social networks and RSS and to help read more meaningful and deep content
https://dev.slowreader.app
GNU Affero General Public License v3.0
153 stars 37 forks source link

Add desktop support for going back from the steps #225

Closed ilyatitovich closed 3 months ago

ilyatitovich commented 3 months ago

Fixes #197

I would like to discuss it.

Checklist

github-actions[bot] commented 3 months ago

Pull request auto-reviewer

Since you changed core/:

ilyatitovich commented 3 months ago

Updated handleEscapeKey() function.

  1. Now we use capturing phase in addEventListener that allow us to stopping propagation early in the event flow.
  2. Then we check route and if it fast or slow we stop propagation for prevent keyux jump, because for add and categories routes is different flow and we need jump back to list + close panel, but for slow and fast routes we need just close panel.
ilyatitovich commented 3 months ago

I changed the conditions for stopping event propagation:

  1. Added role checking - this allows us to avoid unexpected jumps to the side menu if the user clicks on a list item with the mouse and then presses Escape. Now, in this case, the focus will move to the clicked list item.
  2. Added tagName checking to prevent jumping back if the user clicks on a list item, then clicks somewhere else on the screen, and then presses Escape to close the side panel.

Test: video

ai commented 3 months ago

Works amazing. Thanks for helping me polish this.

Hope it helps you to go deeper into keyboard UX world (feel free to ask questions about that roles)

ilyatitovich commented 3 months ago

Yes, I learned a lot :D