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

♿ [#2374] Add more verbose error-text for input fields #1285

Merged
merged 6 commits into from
Jul 3, 2024

Conversation

jiromaykin
Copy link
Contributor

issue: https://taiga.maykinmedia.nl/project/open-inwoner/task/2374
This one is more for cognitive disabilities, where error notifications need to be more clear in the actions they expect from the user.
Would be good to have this in as many forms as possible and not just the 1 emailfield in the profiel-edit page.

@jiromaykin jiromaykin added the Accessibility Improving accessibility label Jun 27, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 41.66667% with 21 lines in your changes missing coverage. Please review.

Project coverage is 44.22%. Comparing base (371f60e) to head (4c31e6b).
Report is 5 commits behind head on develop.

Files Patch % Lines
src/open_inwoner/utils/forms.py 18.75% 13 Missing ⚠️
.../open_inwoner/accounts/tests/test_profile_views.py 52.94% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1285      +/-   ##
===========================================
- Coverage    44.26%   44.22%   -0.05%     
===========================================
  Files          972      972              
  Lines        35414    35602     +188     
===========================================
+ Hits         15677    15744      +67     
- Misses       19737    19858     +121     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jiromaykin jiromaykin force-pushed the feature/2374-A11y-required-field-errortext branch from 64228e1 to 30f1901 Compare June 27, 2024 11:53
@jiromaykin jiromaykin force-pushed the feature/2374-A11y-required-field-errortext branch from f72759b to c590d27 Compare June 27, 2024 12:01
@jiromaykin
Copy link
Contributor Author

The audit report did not mention the text for the error-notification (the ones that always load on top of page) so that's probably not needed here, only the warning error for each input field.

Screenshot 2024-06-27 at 17 38 54

Copy link
Contributor

@pi-sigma pi-sigma left a comment

Choose a reason for hiding this comment

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

The failing test is to be expected, since you're mixing in the newly defined ErrorMessageMixin into UserForm. Update the assertion in the test to reflect the new message.

email = forms.EmailField(required=True, label="E-mailadres")


class ErrorMessageMixinTests(TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's stick to singular nouns for classes. There are many tests in ErrorMessageMixinTest, but there is only one class. I know our code is not consistent, but we should try.

@@ -40,6 +41,24 @@
logger = logging.getLogger(__name__)


class ErrorMessageMixin(FormMixin):
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with your comment that displaying the error message twice is overkill, so this class can be removed.

}

def __init__(self, *args, **kwargs):
user_added_messages = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be simply custom_error_messages, it contrasts with the class-level default_error_messages. This way the code is consistent with the test you wrote.

LoginRequiredMixin,
CommonPageMixin,
BaseBreadcrumbMixin,
ErrorMessageMixin,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed if the above class is removed

@jiromaykin jiromaykin marked this pull request as ready for review July 1, 2024 12:00
@jiromaykin jiromaykin requested a review from pi-sigma July 1, 2024 12:25
@alextreme alextreme merged commit f227fc2 into develop Jul 3, 2024
17 checks passed
@alextreme alextreme deleted the feature/2374-A11y-required-field-errortext branch July 3, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility Improving accessibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants