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

Updated to jQuery Validation 1.11.1 and added aria-live region for reporting inline error message changes #1626

Merged
merged 7 commits into from Mar 24, 2013

Conversation

pjackson28
Copy link
Member

  • Updated to jQuery Validation 1.11.1
  • Fixed jQuery Validation 1.11.1 compatibility issues.
  • Added bridge for supporting the old class={validate:{}} method.
  • Updated form validation working examples to the new data-rule-* approach.
  • Added aria-live region to report any changes in inline error messages.

pjackson28 pushed a commit that referenced this pull request Mar 24, 2013
Updated to jQuery Validation 1.11.1 and added aria-live region for reporting inline error message changes
@pjackson28 pjackson28 merged commit d66e4d6 into wet-boew:v3.0 Mar 24, 2013
@pjackson28 pjackson28 deleted the jquery-valid branch March 24, 2013 07:18
}
}


// Remove the pattern attribute until it is safe to use with jQuery Validation
Copy link
Member

Choose a reason for hiding this comment

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

What is unsafe about the pattern rule?

Copy link
Member Author

Choose a reason for hiding this comment

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

It causes specific error messages to be replaced by generic invalid format messages.

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to just add the translation strings to the i18n files rather than removing a rule?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think the location of the strings is the reason. It just seems to be triggering a generic invalid format error rather than a specific error.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the problem, it is overriding the other more helpful error messages. For instance, if the input must be alpha-numeric and at least 4 characters, it says "Invalid format" rather than "Please enter at least 4 characters." or "Letters, numbers, and underscores only please". Keeping the pattern attribute on seems to quash all other possible error messages, even if they are more relevant. That is why Form validation is removing the pattern attribute for now (until this gets fixed in jQuery Validation).

The pattern attribute is still left on as an example for non-JS scenarios (assuming there is server-side handling).

Copy link
Member

Choose a reason for hiding this comment

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

Has a bug been filed upstream?

Copy link
Member Author

Choose a reason for hiding this comment

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

No it hasn't been. Didn't know what the source was until you pointed out the responsible lines. It wasn't a priority as validation was working without it.

@nschonni
Copy link
Member

PS: I have push access to jquery-validation now, is there any of the aria stuff we should push back?

@pjackson28
Copy link
Member Author

Here are some suggestions:

  • Adding aria-required="true" for all form elements with the required attribute.
  • Using aria-invalid="true" for form elements that have an error.
  • Implementing something similar to the aria-live="polite"/aria-relevant="all" that Form validation now does.

@nschonni
Copy link
Member

I didn't quite get the last bullet there but I started jquery-validation/jquery-validation#706

@pjackson28
Copy link
Member Author

Thanks! The last bullet is about creating a container where you control the updates that get heard by screen readers. In the case of Form validation, it is only once the inline error message changes (and not for every refresh which may or may not have an error message change).

@nschonni
Copy link
Member

Would that attribute be attached to the form element?

@pjackson28
Copy link
Member Author

No, it would just be a new div element (or other element) that gets appended to the form (and is invisible). It's sole purpose is to provide messages to screen readers by replacing the contents of the element each time.

@nschonni
Copy link
Member

OK, can you update the issue with that info

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.

None yet

2 participants