Repository navigation
feat: File panel input/upload button autofocus (BLO-1220) - #3220
matthewlipski wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
|
nperez0111
left a comment
There was a problem hiding this comment.
Something to think about re: focus handling.
When collaboratively editing a document, just because some content exists in the doc (e.g. the upload file button), it does not mean it should get focus immediately via the html autofocus attribute. It should be focused only for the user who triggered the action, e.g. the user who when to insert that content. Otherwise you can distract others on the document by the mere insertion of content into the document.
I've had this bug on my mind for a while, but it is just so annoying to reproduce it (since one machine will only ever have focus on one window at a time), but there is some sort of principal there.
It is okay in the case of the sub-menu, because the user will have already triggered the menu to be open, so they clearly are interested in where it's sub-menus go.
|
But when editing a document collaboratively, shouldn't the menus/toolbars/panels only be open for the client? I mean if I open the file panel, a different user shouldn't see it, and shouldn't lose focus of the editor because the element that takes autofocus doesn't render in the first place. Is that not currently the case? I understand if it's an element in the editor content because then indeed it's rendered for all users, so autofocusing it would mess with everyone. |
Summary
This PR makes it so that the URL input and file upload button in the file panel have
autofocus.Closes #2813
Rationale
This is better for UX and a11y.
Changes
autofocusprop forTextInputandFileInputcomponents in component context.Impact
N/A
Testing
Added a11y tests.
Screenshots/Video
N/A
Checklist
Additional Notes
N/A