-
-
Notifications
You must be signed in to change notification settings - Fork 833
Draft: Add jump to date functionality to date headers in timeline #7317
Draft: Add jump to date functionality to date headers in timeline #7317
Conversation
Part of MSC3030: matrix-org/matrix-spec-proposals#3030 Experimental Synapse implementation added in matrix-org/synapse#9445
@@ -50,21 +50,21 @@ limitations under the License. | |||
} | |||
|
|||
// round the top corners of the top button for the hover effect to be bounded | |||
&:first-child .mx_AccessibleButton:first-child { | |||
&:first-child .mx_AccessibleButton:not(.mx_AccessibleButton_hasKind):first-child { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid style clashes when trying to put a primary accessible button inside of a ContextMenu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a reason not to do that, it won't be accessible for keyboard-only users. Context Menus have strict focus management requirements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(new better flow suggestions welcome) 🙂
Popping off to a modal feels a little heavy.
Tabbing to a date picker in the context menu seems in the realm of sane to handle for the keyboard. But the HTML5 date picker here isn't giving the best UX because ideally we could remove the "Go" button and "Go" automatically when a date is picked. This doesn't seem feasible though because there no way to distinguish a change
from navigating the months of the picker vs a final selection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab in a context menu closes the context menu though as it is focus-locked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can make this work. And seems acceptable under ARIA guidelines:
Tab
: Moves focus to the next element in the tab sequence, and if the item that had focus is not in amenubar
, closes itsmenu
and all open parentmenu
containers.
Shift + Tab
: Moves focus to the previous element in the tab sequence, and if the item that had focus is not in amenubar
, closes itsmenu
and all open parentmenu
containers.-- Menu or Menu bar -> Keyboard Interaction, https://www.w3.org/TR/wai-aria-practices/#keyboard-interaction-12
I had this mostly working in 9fa980c except for closing the menu, but Tab
was navigating the items as expected.
I think I will try to adapt this to use the RovingTabIndex
like the TODO
comment in ContextMenu
mentions so I can register the items explicitly for navigation and be able to tell when we tab out the end or the start to close the menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a RovingTabIndex
example that is known working and well implemented that I can base this off of? The spaces panel and room list seems like a pretty similar thing with the tree view being navigable with arrow keys and can Tab
to the space options of each as you go.
The MessageActionBar
which uses Toolbar
and RovingTabIndex
seems broken as I can't figure out how to navigate by Tab
or Arrow
keys in it.
It also seems counter-intuitive to me that I'm unable to navigate menus by Tab
and have to use Arrow
keys but it also seems inconsistent 🤔. Both seem like they should work.
What's the goal of setting tabindex="-1"
on elements which are focusable? Maybe to get around focus holes in the page with lots of elements? It doesn't seem as applicable in a ContextMenu
which has to be explicitly opened and will close when tabbed out of though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also seems counter-intuitive to me that I'm unable to navigate menus by Tab and have to use Arrow keys but it also seems inconsistent 🤔. Both seem like they should work.
What's the goal of setting tabindex="-1" on elements which are focusable?
See https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets Technique 1
It is so the app doesn't have a million tabstops, and instead each widget is a tabstop with sane and expected keyboard & focus management, e.g arrows. The roving & treeview stuff was written to match the wai-aria practices
Switching to roving was asked for by a lot of our a11y community, who have only the keyboard to use the app with and if they have to press tab ten times to get through every menu that just makes any action they want to take that much slower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MessageActionBar
does seem to have regressed.
The space panel, room list, space home are all roving focus managed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#7336 fixes MAB, during a refactoring something got missed I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into the fixes for the MessageActionBar
! 🌟 I've created a v2 PR, #7339, based off of those fixes and wanting to refactor ContextMenu
to use RovingTabIndex
so that I can leave this PR untouched in its somewhat working state.
@@ -127,6 +127,7 @@ limitations under the License. | |||
transform 0.25s ease-out 0s, | |||
background-color 0.25s ease-out 0s; | |||
font-size: $font-10px; | |||
line-height: normal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset line-height
so it acts normal regardless of environment (ContextMenu
has a very large line-height
)
const code = e.errcode || e.statusCode; | ||
// only show the dialog if failing for something other than a network error | ||
// (e.g. no errcode or statusCode) as in that case the redactions end up in the | ||
// detached queue and we show the room status bar to allow retry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Update comment, copy-paste artifact
This currently works except for closing the menu when you Tab or Shift + Tab out of the boundaries of the menu. > - `Tab`: Moves focus to the next element in the tab sequence, and if the item that had focus is not in a `menubar`, closes its `menu` and all open parent `menu` containers. > > - `Shift + Tab`: Moves focus to the previous element in the tab sequence, and if the item that had focus is not in a `menubar`, closes its `menu` and all open parent `menu` containers. > > https://www.w3.org/TR/wai-aria-practices/#keyboard-interaction-12 I'm going to try to migrate this to using the RovingTabIndex which is mentioned in a TODO comment and will probably make this more sane
You should probably also add this menu in the room info panel or similar, since unlike in your screenshot the closest date header might be pages and pages back if the room is somewhat active. |
@@ -50,21 +50,21 @@ limitations under the License. | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably also add this menu in the room info panel or similar, since unlike in your screenshot the closest date header might be pages and pages back if the room is somewhat active.
@HarHarLinks As separate iterations, the plan is to make the date headers sticky so one is always visible.
And add a slash command /jumptodate 2021-12-10
Add jump to date functionality to date headers in timeline
Fix element-hq/element-web#7677
Part of MSC3030: matrix-org/matrix-spec-proposals#3030
Experimental Synapse implementation added in matrix-org/synapse#9445
Dev notes
Combining React callback refs and ref-refs,
TODO
MenuItems
This PR currently has no changelog labels, so will not be included in changelogs.
A reviewer can add one of:
T-Deprecation
,T-Enhancement
,T-Defect
,T-Task
to indicate what type of change this is, or addType: [enhancement/defect/task]
to the description and I'll add them for you.Preview: https://61b30b58b34514d9ad23d6d6--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.