fix(notes): make SellNoteModal dropzone accessible to keyboard and sc… - #216
Open
kartikbhardwaj1111 wants to merge 1 commit into
Open
fix(notes): make SellNoteModal dropzone accessible to keyboard and sc…#216kartikbhardwaj1111 wants to merge 1 commit into
kartikbhardwaj1111 wants to merge 1 commit into
Conversation
|
Hi @kartikbhardwaj1111, thanks for contributing to Nyay Setu! 🎉 I have automatically:
Our workflows will now analyze your changes to classify:
Tip Ensure your PR description references the issue it resolves (e.g. Happy coding! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
devas the base branch unless instructed otherwiseWhat changed
Accessibility Semantics & Attributes:
role="button"to announce the dropzone as an interactive button to assistive technologies.tabIndex={0}so keyboard users can navigate to the dropzone using Tab.aria-labeldescribing the upload action or displaying the selected file name & size.Keyboard Interaction:
onKeyDownhandler that triggers the system file picker when pressing either Enter or Space (withe.preventDefault()on space to prevent accidental page scroll).Visible Focus & Drag-and-Drop States:
focus:outline-none focus:ring-2 focus:ring-[#6366f1] focus:ring-offset-2 focus:ring-offset-[#111111]) complying with WCAG 2.4.7.dragOverstate handling (onDragOver,onDragLeave,onDrop) with active visual feedback matching theUploadPYQModal.tsxpattern.Event Propagation & Alerts:
onClick={e => e.stopPropagation()}on the hidden file input to avoid click event bubbling recursion.role="alert"on form error messages so validation errors are spoken aloud by screen readers.Automated Unit Tests:
frontend/src/components/notes/__tests__/SellNoteModal.test.tsxcovering keyboard triggers, ARIA roles, drag & drop, file validation, and form submission.Why this change is needed
Previously, the PDF upload area in
SellNoteModalwas implemented as a plain<div>with only anonClicklistener. It was inaccessible to keyboard-only and screen-reader users, violating WCAG 2.1 Level A (2.1.1 Keyboard Navigation, 4.1.2 Name/Role/Value) and blocking students with disabilities from selling notes.Testing
Test Results:
7 of 7 passed (100%)inSellNoteModal.test.tsx0 errors, 0 warnings0 errorsScreenshots