Skip to content
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

Added DropdownMenu #24

Merged
merged 19 commits into from
Jan 22, 2024
Merged

Added DropdownMenu #24

merged 19 commits into from
Jan 22, 2024

Conversation

Dantemss
Copy link
Member

@Dantemss Dantemss commented Jan 8, 2024

For: https://github.com/openstax/unified/issues/2727

A dropdown menu activated by a button with a caret. I'm using it for actions, not navigation, so I made the items buttons instead of links.

@Dantemss Dantemss self-assigned this Jan 8, 2024
jivey
jivey previously requested changes Jan 16, 2024
Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding a ladle story for this? Not sure if you've done one yet, you can see some examples in the repo, they are named *.stories.tsx and you can run the local preview server with yarn ladle serve

@TomWoodward
Copy link
Member

also the keyboard navigation doesn't follow the example we discussed https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/examples/menu-button-links/

@Dantemss
Copy link
Member Author

Thanks for reminding me... most of the keyboard navigation is no good... I'll look into implementing these

@Dantemss Dantemss marked this pull request as draft January 17, 2024 23:01
@Dantemss
Copy link
Member Author

OK I believe I added all the keyboard navigation stuff from that link. Let me know if you see that I missed something.

@Dantemss Dantemss marked this pull request as ready for review January 18, 2024 23:32
@Dantemss Dantemss requested a review from TomWoodward January 18, 2024 23:33

return <>
<DropdownMenu id='enabled-grades-menu' state={enabledState} text='Sync/Export Grades' variant='primary'>
<DropdownMenuItemButton onClick={onClick} state={enabledState}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the MenuItemButtons should always have the same state as their enclosing DropdownMenus, you should consider making that a Context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give that a try

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do as roy suggests you can also move the useDropdownMenu call and state provider into the dropdown menu component, removing the burden of managing that from the consumer call

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the context provider and removed export for useDropdownMenu

@Dantemss Dantemss merged commit 7671ccb into main Jan 22, 2024
2 checks passed
@Dantemss Dantemss deleted the dropdown-menu branch January 22, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants