-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix(Input): Clarification that developers should use ref
with Input
. Add a new example for Storybook.
#1526
base: dev
Are you sure you want to change the base?
Conversation
…t`. Add a new example for Storybook.
🦋 Changeset detectedLatest commit: 9383400 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Scheduled a meeting to discuss this as a team, so lets put this on hold for now. |
@@ -170,6 +170,8 @@ export function Example() { | |||
If an input has an `errorMessage`, the input will be styled to highlight it's error state and the error message will appear below the input field. | |||
If an error message is present, it will replace the helper text. Can be a node or a string. | |||
|
|||
For best practices, use a `ref` on the input to enhance usability when handling an `errorMessage`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can move this sentence to go right after While React Magma provides the error styling, it is up to the consumer app to handle the validation
and we can elaborate a little more
It would read something like:
While React Magma provides the error styling, it is up to the consumer app to handle the validation. We recommend using a
ref
on the input for accessibility.For short forms with an error, clicking submit should bring the focus back to the input with an error. For long forms, we recommend using an alert to combine the errors and focus should be moved to the alert. See example in Form.
…/react-magma into fix/Input-error-message-not-read
header="Form Heading" | ||
description="Some Form Description" | ||
errorMessage="Some Form Error" | ||
errorMessage={errorMessage} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, the only thing is that the alert does not get focus / the message is not announced with a screenreader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has not been addressed yet: https://jam.dev/c/7e5f61b7-cf01-4511-acdc-409d1b8760e0
I think I expect the focus to move to the alert so that the error message can be read. Maybe it needs to be assertive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge conflicts also need to be addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just missing addressing this, since this is what we describe in the docs:
#1526 (comment)
Issue: #1124
What I did
Add clarification that developers should use
ref
withInput
. Add a new example for Storybook.Screenshots:
Checklist
How to test
Open
Input
in the docs -> OpenError message
-> Leave the input blank and clickSubmit
-> Check that the input has focus.