-
Notifications
You must be signed in to change notification settings - Fork 748
textField - a11y label improvements #3883
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
Open
yotam-wix
wants to merge
13
commits into
master
Choose a base branch
from
textField-Validation-A11yLabel
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+29
−1
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1e5dce7
a11y improved for charCounter
yotam-wix 4026949
yml change
yotam-wix 4a42af2
created a backwards value read in different component
yotam-wix dd6ffe9
switched to logic of [label], [charCounter text]
yotam-wix aaf7873
Improved a11y label, unified all parts of textField into one, added u…
yotam-wix bc133c7
removed previous implementation of a11y in textField
yotam-wix 9603ac8
removed comments and unnecessary spaces
yotam-wix 87b2c70
Merge remote-tracking branch 'origin/master' into textField-Validatio…
yotam-wix d9b71a9
Merge branch 'master' into textField-Validation-A11yLabel
yotam-wix 65b7afd
Update .yarnrc.yml
yotam-wix ef2b7c4
added support of props
yotam-wix 4d2f432
fix conditional hook bug
yotam-wix 34093b9
Merge branch 'master' into textField-Validation-A11yLabel
yotam-wix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,9 +138,37 @@ const TextField = (props: InternalTextFieldProps) => { | |
| [typographyStyle, colorStyle, others.style, centeredTextStyle, hasValue]); | ||
| const dummyPlaceholderStyle = useMemo(() => [inputStyle, styles.dummyPlaceholder], [inputStyle]); | ||
|
|
||
| const defaultAccessibilityLabel = useMemo(() => { | ||
| const parts: string[] = []; | ||
|
|
||
| if (label) { | ||
| parts.push(label); | ||
| } | ||
|
|
||
| if (context.isMandatory) { | ||
| parts.push('required'); | ||
| } | ||
|
|
||
| parts.push('textField'); | ||
|
|
||
| if (helperText) { | ||
| parts.push(helperText); | ||
| } else if (placeholder) { | ||
| parts.push(placeholder); | ||
| } | ||
|
|
||
| if (showCharCounter && others.maxLength) { | ||
| parts.push(`you can enter up to ${others.maxLength} characters`); | ||
| } | ||
|
|
||
| return parts.join(', '); | ||
lidord-wix marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, [label, context.isMandatory, helperText, placeholder, showCharCounter, others.maxLength]); | ||
|
|
||
| const accessibilityLabel = props.accessibilityLabel ?? defaultAccessibilityLabel; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can extract the prop like all other props instead of using |
||
|
|
||
| return ( | ||
| <FieldContext.Provider value={context}> | ||
| <View {...containerProps} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}> | ||
| <View {...containerProps} accessible accessibilityLabel={accessibilityLabel} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}> | ||
| <View row spread style={centeredContainerStyle}> | ||
| <Label | ||
| label={label} | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.