Fix focus behaviour when opening single-purpose pages, and rooms
Description
This PR improves focus behaviour as formulated in #2348 when opening pages/popups that have a singular purpose. It also focuses the message field when opening a room, to more clearly indicate to the user that they can begin typing immediately.
The reasoning for suggesting these changes is primarily that pages where you can only do one thing, should let you do those things in one click (ie. search, creating new DM). Focusing on the message field enables simply entering a room and immediately starting to type (while the user can currently do this, that is not communicated to the user). Not gaining focus on mobile prevents the onscreen keyboard from appearing when it's not wanted (ie. when just reading messages).
This also unifies the UX as CTRL+K search already gains focus automatically.
This PR makes the following changes:
The following always gain focus:
- "Join with Address"
- "Message Search" (Spaces and Home)
- "Create Chat" (new DM, invite to room)
The following gain focus when not on mobile:
- Room message field
Example videos:
Current:
https://github.com/user-attachments/assets/558c55a6-6ba6-44df-a900-579b5d837b21
https://github.com/user-attachments/assets/71c01e1b-69c6-4649-9099-de8b59a0b19d
After changes:
https://github.com/user-attachments/assets/44f5c9a4-4fcb-4b61-a80b-c8f9adae39f9
https://github.com/user-attachments/assets/3595fb04-0fad-46ef-af8d-41ac57d0f27f
Fixes #2348, Fixes #2261
Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [o] New feature (non-breaking change which adds functionality)
- [o] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [o] This change requires a documentation update
Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings