-
Notifications
You must be signed in to change notification settings - Fork 355
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
Descriptionlist in drawer demo #10229
base: v5
Are you sure you want to change the base?
Descriptionlist in drawer demo #10229
Conversation
Preview: https://patternfly-react-pr-10229.surge.sh A11y report: https://patternfly-react-pr-10229-a11y.surge.sh |
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.
The core demo is setup so that the drawer is attached to the <Page>
component's main content area. AFAIK the only way to do that on the react side is to use the <Page notificationDrawer={}>
prop, which you can find references to in the notification drawer demos.
Someone on the react side please verify that though, I may just not know how to do it differently.
That will fix this issue where the drawer is attached to a page section (screenshot from the demo)
And should make it look like this (screenshot from the core demo)
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
I'll try it. |
|
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.
One issue with the core demo and this one is that the drawer can't be opened via keyboard, since the Cards beings used in the main page content area aren't interactive in any way.
If the intent is that we want to show how to have cards that can open their own drawer for their own DescriptionList, we should use actionable cards (and optionally ensure each Drawer has a unique title based on the card that was clicked to convey that intent better?). If it's more simply to just show a description list in a drawer, would a single button in the main page area suffice? cc @mmenestr
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
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.
Couple more comments below, otherwise we would just need input on my previous comments above from design/core
packages/react-core/src/demos/DescriptionList/DescriptionList.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/demos/DescriptionList/DescriptionList.md
Outdated
Show resolved
Hide resolved
const onCloseClick = () => { | ||
setIsExpanded(false); | ||
}; | ||
|
||
const onOpenDrawer = () => { | ||
setIsExpanded(true); | ||
}; |
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.
In addition to opening/closing the drawer, we should set focus on the appropriate element.
- For the Drawer onExpand, the close button of the Drawer should receive focus, similar to our basic drawer example
- When the Drawer gets closed, focus should be set back on the element that previously had focus before the Drawer was expanded. In this case it's easier since there's only the one button controlling expansion.
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.
Can you please help me on first point, is there any props in drawer component for setting focus on close button. In basic drawer example, I can't see the focus on close button.
Second point I've covered.
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.
Ah yeah so in that example I linked we're focusing the content of the drawer rather than the close button. We should actually do a similar thing here since the close button comes after the content in the DOM. We can just add a ref
similar to that basic drawer example.
We'll also want to move the logic you currently have on the "Open drawer" button, tabIndex={isExpanded ? 0 : -1}
to the drawer content title.
set focus back on button after closing drawer
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.
LGTM! One typo and an outstanding question about whether we should include tabs or not.
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
Sorry I missed your previous comment @thatblindgeye - it's true that a selectable/deselectable card would be a more accurate way to show a drawer interaction via a card view, rather than just having link in a card. But I think since this demo is for the purpose of showing a description list in a drawer, the interaction is fine as is! If you have extra time on your hands though, I would change it to a clickable card interaction because people get confused when we show different interactions in different places and don't know which one is "correct". And it could just be a single card, doesn't need to be a full page of clickable cards... Will let you guys make the call though! Everything in the drawer looks good though!! |
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx
Outdated
Show resolved
Hide resolved
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.
This is looking good! We'd probably want to open an issue to update the core demo to match this if this is what we want it to look like (cc @mcoker ).
Can you try force pushing to this PR? For some reason the PR is building oddly in that it's building a drawer based on the latest update and as though we're still creating a Drawer component inside the demo. Pulling the PR locally everything seems fine, though.
I tried force push but nothing happened. Any idea, why a11y job is failing |
The a11y tests are failing on this PR: https://patternfly-react-pr-10229-a11y.surge.sh/ because there is a rendered DrawerPanel in a DrawerPanel which both have the This is happening because you are passing a Drawer component via the |
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.
This PR has been automatically marked as stale because it has not had recent activity. |
What: Closes #10227
Descriptionlist in drawer demo
Additional issues: