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
feat: use component library's dropdown component in learn #50465
Conversation
👀 Review this PR in a CodeSee Review Map |
feat: improve dropdown styles feat: add hot reloading for component library CSS feat: add componet library to learn
4a7d2ae
to
266e9e0
Compare
Hey @ahmadabdolsaheb what's the plan re: publishing? Are we going to publish to npm first or rework this to use the local code? |
We could do either of the followings: |
Both seem reasonable to me. Option 2 sounds like it might waste less time, so do you want to go with that? |
Package published: https://www.npmjs.com/package/@freecodecamp/ui |
Another round of reviews then merge? |
@ahmadabdolsaheb it looks like there are a couple of issues. Firstly pnpm defaults to using the Secondly, the types aren't quite working correctly. To fix this we'll need a |
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Next stepsTake a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with |
a51dd18
to
8961d44
Compare
The timeline jest tests need a little work. After that, it should be good to go. |
Jest to e2e test migration could be addressed in an upcoming pr to unblock this pr.
Either a multifile project needs to be added to the certified seed object or cypress needs to submit one so it shows up as the last one on the timeline. |
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.
Hey @ahmadabdolsaheb the new dropdown looks great, but doesn't seem as friendly from an a11y perspective.
Right now, in production, it's possible to tab onto a dropdown, press enter to expand and then use the arrow keys to navigate between the options.
In this PR all of that is works except for the arrow key navigation, so it's not possible to make a selection.
I'd rather we delayed a bit than shipped a less accessible version.
@ojeytonwilliams should be fixed. |
Thank you @ojeytonwilliams, the pnpm upgrade did the trick. I'll try to remember that next time. I'll put this through its paces and write up any notes soon. |
Here are my notes for the Get Help menu in the JS ADS challenges. Should be fixed:
Nice to have but not required:
|
Thanks for the meticulous review, @bbsmooth. One thing I'm curious about is this: can we automate this kind of QA? At least now that you've pointed out what needs to be happening. Some unit tests with react-testing-library's tools would be good, assuming they can catch the issues you described. |
More information on the issue with keyboard focus not automatically being placed on the first menu item when using JAWS/NVDA. This menu implementation is using But when using JAWS/NVDA, the I'm also finding this bug on the headless ui menu example. So this seems like a bug with the component itself and not something we are doing. I guess I'll need to put together a codepen demo and open an issue in their github. |
Thanks for the meticulous review, @bbsmooth. Just have a few questions regarding the dropdown menu implementation:
Does this mean to have the icon wrap to the next line on smaller screens?
I have no idea how to start implementing this, so pointers are appreciated. |
Sorry, I might not have been as clear as I could have been. If focus is currently on the top item in the menu, pressing the up arrow key moves focus to the bottom item. Likewise, if focus is currently on the bottom item, pressing the down arrow key moves focus to the top item. This is not required keyboard functionality, just nice to have, and the menu on production currently has it. |
It seems like bootstrap modal finds the last active element before the modal is open and set .focus() to that element when the modal is closed. |
Co-authored-by: Bruce Blaser <bbsmooth@gmail.com>
@bbsmooth, this should cover our bases. I was wondering if we could move forward without the followings since they need to be resolved on headlessui's side?
|
Yes, definitely. I don't think either of these issues are blockers. The arrow wrap is definitely not (just nice to have). The lack of focus on the first menu item when using NVDA/JAWS is slightly more annoying but won't keep these users from using the menu. I plan on creating an issue for this when I have a few minutes to put together a good demo. |
Well, I found another "issue" but I don't think there is anything we can do about it (this seems to be a bug in headlessui). When you open the menu with a keyboard and it places focus on the first menu item, if you then hit the Tab key it closes the menu and places the focus on the next focusable item on the page after the "Get Help" button (which is the JS editor in this case). That is the expected behavior. But if you do the same thing but use And just one very minor nitpick under our control. If you don't think it is worthy of fixing now, that's fine. If it really bugs me I can open my own PR. As you can see in the above pic, when zoomed in, the left side of the focus outline is cut off so only 1px is showing. I think setting Otherwise, the other fixes look good and this is ready to go. |
Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>
@bbsmooth, the changes that are in our control from your latest comment are in. |
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.
This pr includes
Remaning tasks:
1 - extract types declarations from the component library and import them to learn.
2 - style the toggle button when toggled to look like the hover state using headless ui's internal state.
3 - include the linking scripts in package.json.
4 - build and publish the component library upon approval.
Checklist:
main
branch of freeCodeCamp.Closes #XXXXX