You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(kb) introduce "regions" keyboard navigation with RegionFocusSwitcher
RegionFocusSwitcher makes it possible for the user to cycle through app
panels and document widgets (named "regions" as a whole) with one
keyboard shortcut.
1) On a grist document page, pressing the shortcut jumps your keyboard
focus from widget to widget, but also panel to panel. You go to widget
1, widget 2, then left panel, top panel, then widget 1, widget 2, etc.
This shortcut is necessary to reach stuff outside widgets: because by
default, usual kb shortcuts like tab or arrow keys are highjacked by
widgets.
On other pages (that don't have widgets), pressing the shortcut jumps
your keyboard focus from panel to panel, but this time it also includes
the main content area as a "panel". The shortcut is not _that_ necessary
on other pages since you can now use Tab normally. But I guess it's
better to keep the shortcut always work whatever the page.
2) The new creatorPanel command allows to keyboard focus from/to the
creator panel.
This is a separate command from the regions-cycling, as the creator
panel is tied to the currently focused viewLayout section. So we must be
able to focus a section, and then directly go to the creator panel in
order to configure it.
If we notice the user just spammed the Ctrl+O shortcut too much, we
assume he just tried accessing the creator panel and we show him the
keyboard shortcut.
3) View now keeps track of this new stuff, in order to disable the
viewSection commands when focusing panels. This is an important trick
that lets us enable the Tab key and others when focusing the panels.
4) The new navigation shortcuts are now always on, even in inputs.
Using ctrl+o is somewhat problematic because it is the default browser
shortcut for opening files, so in cases where we don't catch the
keypress, the filechooser appears. We want to avoid that as much as
possible.
5) The main trick allowing us to easily allow Tab navigation on panels,
while on a grist docs page, is the change in Clipboard.js. We can now
set a 'clipboard_group_focus' class somewhere in the dom, and the
clipboard will allow focusing elements on elements inside the one having
the class.
This is not done yet:
- needs more actual usage testing to finetune the behavior and make sure
it is what we want.
- I need to check every page using the `pagePanels` function, as a new
div wraps the content and may make the layout buggy
- needs tests
0 commit comments