Repository navigation
fix: activate CollapsibleTrigger on Space key - #4595
nishchayg9775 wants to merge 1 commit into
Conversation
✅ Deploy Preview for paragon-openedx-v23 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks for the pull request, @nishchayg9775! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Submit a signed contributor agreement (CLA)
If you've signed an agreement in the past, you may need to re-sign. Once you've signed the CLA, please allow 1 business day for it to be processed. 🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Fixes #4471
CollapsibleTriggerrenders withrole="button"but only activated on Enter, so keyboard users pressing Space got no response (and the page could scroll). This adds Space activation following native button behaviour:keydowncallspreventDefault()to stop page scrolling and records the press without toggling, so holding Space does not repeat-toggle.keyuptoggles once, if the keydown happened on the trigger.Spacebarkey value is accepted alongside' '.onKeyUpis now destructured and invoked (it previously passed through via props), and typed inCollapsibleTriggerProps.Note on timing: the issue suggested handling Space in
handleKeyDownlike Enter. I implemented keyup activation instead to match native<button>behaviour and the WAI-ARIA APG button pattern. Happy to switch to keydown activation if maintainers prefer the simpler approach.Tests added in
Collapsible.test.tsx:onKeyUpprop is calledSnapshot updated for the new
onKeyUphandler.Test results:
npx jest src/Collapsible/Collapsible.test.tsxpassed 27/27, and ESLint on the two changed source/test files passed.AI disclosure
This contribution was prepared with assistance from Claude (AI). I have reviewed the change, understand it, and take responsibility for it. My signed Individual CLA was emailed to legal@tcril.org on 5 December 2026 and may still be processing.