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

[#8443] polls: refactor PollQuestion.jsx and add TextareaWithCounter.jsx #1687

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

hom3mad3
Copy link
Contributor

@hom3mad3 hom3mad3 commented Nov 4, 2024

Changes

expandabletextarea

  1. Refactored Poll Textarea Component

    • The Poll textarea is now handled in TextareaWithCounter.jsx.
    • Initially intended to create a global reusable textarea with a counter, but for now, this implementation is specific to PollDetail. Future cases will be addressed if this approach is adopted globally.
    • The implementation was inspired by the GOV.UK Design System's character count component
  2. Breaking Change: Textarea Visibility Logic

    • Updated logic to affect the entire visibility of the textarea container.
    • The container is now displayed only when the "other" option is selected. Improves UX by following progressive disclosure pattern and performance/load by avoiding loading hidden/unnecessary elements.
    • Added dynamic handling for textarea height and optimized for persistent data when the option is untoggled by mistake with React.memo.
  3. Accessibility and Semantic Enhancements

    • Improved accessibility and semantic structure.
    • Added label to textarea
    • Added aria support
    • Separated logic into smaller, more maintainable chunks for better readability.
  4. Component Renaming and Refactoring

    • PollQuestion.jsx is now renamed to PollChoice.jsx for consistency with PollDashboard.
    • The component was broken down into smaller sub-components to enhance readability and maintainability.
  5. Test Updates

    • Updated test data dump and adjusted tests to align with the new changes.

Improvement Ideas

  • CharCounter.jsx: Consider better handling for screen readers to improve accessibility and provide clearer feedback for users with assistive technologies.
  • Questions should be optimized for accessibility as well or at least improvement of semantics.

@hom3mad3 hom3mad3 force-pushed the mr-2024-11-refactor-textarea-poll branch from c6d7590 to 20c9ab0 Compare December 5, 2024 11:45
@hom3mad3 hom3mad3 changed the title [wip] polls: refactor PollQuestion.jsx and add TextareaWithCounter.jsx [#8443] polls: refactor PollQuestion.jsx and add TextareaWithCounter.jsx Dec 5, 2024
@hom3mad3 hom3mad3 requested a review from goapunk December 5, 2024 11:46
Copy link
Contributor

@goapunk goapunk left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! I just left some small notes regarding the mock and the textarea

@hom3mad3 hom3mad3 force-pushed the mr-2024-11-refactor-textarea-poll branch from 20c9ab0 to 7cdddff Compare December 9, 2024 16:32
@hom3mad3 hom3mad3 force-pushed the mr-2024-11-refactor-textarea-poll branch from 7cdddff to bb6708b Compare December 10, 2024 13:12
@goapunk goapunk self-requested a review December 11, 2024 13:47
Copy link
Contributor

@goapunk goapunk left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@goapunk goapunk merged commit 881698e into main Dec 11, 2024
3 of 5 checks passed
@goapunk goapunk deleted the mr-2024-11-refactor-textarea-poll branch December 11, 2024 13:48
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.

2 participants