-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add back rowLinkTo and handleRowClick behaviors #1033
Conversation
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.
Looks good @martha!
The keyboard navigation experience feels a little bit degraded because of the need to press tab twice to get to the next row (since you tab over to the menu icon). Maybe that's unavoidable, but just noting it, if you have any ideas. For example the Projects table, it seems particularly unnecessary since that menu isn't actually providing any additional nav functionality.
'&.Mui-focusVisible': { | ||
outlineOffset: '-2px', | ||
}, |
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'm not seeing the outline visually when testing. This fixes it for me:
outline: 'auto',
outlineOffset: '-5px',
(5px so it doesn't get unevenly cut off, but maybe that's preferable to having it more inside the cell - could go either way
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! I think -5px is good.
outline: 'auto'
for me makes the outline look black, so I also added an outlineColor
that matches what we apply to buttons in our theme.ts
. Interesting that this is treated differently in Chrome than Safari.
@gigxz 100% agree about the keyboard nav experience :(. two ideas:
Edit: Playing around with both of these, I prefer 1. The extra step is just that you have to press enter twice, so it doesn't seem that bad. |
@martha I like the tab nav experience! But I just noticed that we now lose any keyboard navigability for tables that use Since the presence of the action column is affecting focus and linking behavior of the table as whole, maybe the answer is to move it back to a prop and remove it from the <GenericTable
recordName={optional, gets passed along to TableRowActions
renderMenuActionButton={row => ReactNode} // optional, gets passed along to TableRowActions. typically not a navigation action. bulk services uses
// optional, renders each item in the three-dot menu. optionally specify performOnRowClick on max 1 item IF you want to perform this action when clicking the row. (if specified on multiple, raise)
// all gets passed along to TableRowActions. we just look at performOnRowClick in generic table
menuActionConfigs={row => [{ to: safePath, performOnRowClick: true}, {to: otherSafepath}, ... ] }
/> What do you think? Please feel free to push back! |
Ooh, yeah thanks for catching that. I am open to this idea. Let's also confirm/gut-check: Does it seem worth it to implement vs. just reverting to this behavior from one iteration ago, where both the primary column AND the nav menu are keyboard accessible? For consistency going forward, our desired pattern is to never use <GenericTable
recordName={''}
rowLinkTo={''}
handleRowClick={() => {}}
// if either rowLinkTo or handleRowClick is provided, then render TableRowActions, regardless of whether additional secondaryActionConfigs have been passed
secondaryActionConfigs={[{ to: safePath, ... }, {onClick: ...}, ... ] } // optional, only provided if there are additional menu items in here besides the primary one
primaryAction={optional, only used for 'fancy' primary action, like bulk services} // `primaryAction` maybe is mutually exclusive with `rowLinkTo` and `handleRowClick`?
// or maybe update the naming... I think of "primary action" as referring to the row onclick behavior
/> What do you think? |
This is true for the majority of the application's tables, but I don't think we should build ourselves out of simple clickable rows (ie If we just default to showing the menu instead of specifying it using a |
I think I could go either way. I made a start on implementing this and was happy with how much code cruft we could delete, which makes me feel biased towards the You are right about the additional props. I was thinking of trying to reuse the
but that is starting to feel like a lot of churn. |
This also re-raises this challenge with Bulk Services. To summarize,
I would be happy to take a stab at a more satisfactory refactor than I attempted here. (Maybe this is one of those scenarios where "you might not need an effect"?) But it is starting to feel like scope creep... So maybe an acceptable solution for now is to keep this button in a column definition. (in other words, no change from how it's currently implemented.) I think that is still compatible with the other changes we're proposing since this table doesn't have a row click target. Does all that make sense? What do you think? |
@martha yes I think based on your description, it would be wise to leave the Bed Night workflow table as-is for now, and update it later to add the new menu and address the loading state issues. |
Cool I think we should just go with this then. Additional props for customization seem like a fine tradeoff, to make the common case straightforward. If you push up what you have, I can try to wrap it up while you're out. Thank you! |
Ok, thanks so much @gigxz ! I pushed up what I have. I think it should be almost there. But feel free to make any modifications (rename the new props, etc.) directly on this branch. I also have been thinking that the diff may be somewhat easier to review once this is merged to the deploy branch, since this PR reverts some of the changes on that branch! |
Description
GH issue: https://github.com/open-path/Green-River/issues/6761
Based on our decision in slack (thread)
Summary of changes:
TableRowActions
component'sprimaryActionConfig
prop. You can still pass aprimaryAction
, whichBulkServices
does, but otherwise all of the action configs go in the dropdown menu and are now calledmenuActionConfigs
rowLinkTo
andhandleRowClick
on tables where they were removed in the base deploy branchrowLinkState
prop toGenericTable
linkTreatment
andariaLabel
linkTreatment
goes against our updated pattern and should no longer be used (I'm open to removing its removal from this PR if you prefer, though, since there are some out-of-scope tables that still use it)ariaLabel
is not needed anymore, since row links are accessible through the row action menu and have accessible labels there.Implementation notes for posterity
onClick
handler on the row for bothhandleRowClick
androwLinkTo
, thinking this was desirable because it removed link markup from each cell in the table, making the table easier to understand when navigating via screenreader.RouterLink
in each cell. The screenreader does still now read "link" on each cell, but otherwise it reads the cell contents. The first menu item is accessibly marked up with more detail about where the link will take you. I think this is an OK tradeoff.Type of change
Checklist before requesting review