Repository navigation
fix(text-input): align supporting text, counter and accessories in RTL on web #5221
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
base: main
Are you sure you want to change the base?
Changes from all commits
41cbbc2
a27dfea
3b0fd27
e965f08
348793c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -243,6 +243,7 @@ export const getSharedTextInputStyleData = ( | |
| styles.supportingText, | ||
|
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. No longer raised on 🟡 Minor · RTL-only web styles and logical The label wrapper now gets Suggested change Verify the web output in a browser build (the docs/example app with DetailsAlso raised hereAlso raised at this location by persona persona: Useful? Reply Reply
Collaborator
Author
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. @apex-sentinel-staging like Fixed: Web-only branches never ran in Jest, assertions only checked that keys existed or used the LTR/native value and missleading test names. 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. Thanks for the feedback. It helps us make these findings more useful. |
||
| { | ||
| color: supportingTextColor, | ||
| textAlign: isRTL && Platform.OS === 'web' ? 'right' : 'left', | ||
| writingDirection: isRTL ? 'rtl' : 'ltr', | ||
| }, | ||
| isDisabled && styles.disabled, | ||
|
|
@@ -252,6 +253,7 @@ export const getSharedTextInputStyleData = ( | |
| styles.counter, | ||
| { | ||
| color: supportingTextColor, | ||
| textAlign: isRTL && Platform.OS === 'web' ? 'left' : 'right', | ||
| writingDirection: isRTL ? 'rtl' : 'ltr', | ||
| }, | ||
| isDisabled && styles.disabled, | ||
|
|
@@ -263,6 +265,7 @@ export const getSharedTextInputStyleData = ( | |
| fontSize: INPUT_FONT_SIZE, | ||
|
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. No longer raised on 🆕 🟡 Minor · prefix/suffix now get writingDirection on native too, outside the PR's web-only scope On native with Suggested change DetailsAlso raised hereAlso raised at this location by persona persona: Useful? Reply Reply
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. /note This holds on iOS only: Android ignores 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. Withdrawing this finding You're right that the input itself already carries the same ungated Useful? Reply |
||
| color: onSurfaceVariant, | ||
| paddingEnd: PREFIX_END_PADDING, | ||
| writingDirection: isRTL ? 'rtl' : 'ltr', | ||
| }, | ||
| isDisabled && styles.disabled, | ||
| ]; | ||
|
|
@@ -273,17 +276,20 @@ export const getSharedTextInputStyleData = ( | |
| fontSize: INPUT_FONT_SIZE, | ||
| color: onSurfaceVariant, | ||
| paddingStart: SUFFIX_START_PADDING, | ||
| writingDirection: isRTL ? 'rtl' : 'ltr', | ||
| }, | ||
| isDisabled && styles.disabled, | ||
| ]; | ||
|
|
||
| const leadingAccessoryStyles: StyleProp<ViewStyle> = [ | ||
| styles.leadingAccessory, | ||
| isRTL && Platform.OS === 'web' && styles.leadingAccessoryRTL, | ||
| isDisabled && styles.disabled, | ||
| ]; | ||
|
|
||
| const trailingAccessoryStyles: StyleProp<ViewStyle> = [ | ||
| styles.trailingAccessory, | ||
| isRTL && Platform.OS === 'web' && styles.trailingAccessoryRTL, | ||
| isDisabled && styles.disabled, | ||
| ]; | ||
|
Comment on lines
284
to
294
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. No longer raised on 🟡 Minor · RTL-only web styles are untestable and untested in the default (native) jest platform The 'places the label on the right side when RTL' test asserts only Suggested change Add at least one test with DetailsAlso raised hereAlso raised at this location by persona persona: Useful? Reply Reply
Collaborator
Author
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. @apex-sentinel-staging like Fixed within previous comment. 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. Thanks for the feedback. It helps us make these findings more useful. |
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
No longer raised on
348793c: marked fixed by kachmashk in this comment; the code it pointed at changed.🆕 🟡 Minor · New test for the counter-without-supporting-text spacer cannot fail without the change
The new
it('renders the counter without supporting text')passes on pre-change code because the counterTextwas already always rendered by{hasCounter && ...}(TextInput.tsx:542), sotoBeOnTheScreensays nothing about the newaddendumSpacerbranch at TextInput.tsx:538-540. Deleting that branch leaves the whole suite green.Suggested change
Give the spacer a testID and assert it is rendered as a sibling before the counter inside the addendum (or assert the counter's resolved position), so the test fails when the spacer branch is removed.
Details
Also raised here
Also raised at this location by persona
senior-developer: Counter-only spacer fix is asserted by a test that passes without it — The new testrenders the counter without supporting text(src/components/tests/TextInput.test.tsx:1471) only assertsexpect(screen.getByText('2/10', includeHiddenElements)).toBeOnTheScreen(). The counter Text is rendered unconditionally by thehasCounter && (...)branch in TextInput.tsx:542 and is already asserted this way on native at lines 969 and 983, so the new test passes identically with theaddendumSpacerView and thesupportingText ? ... : hasCounter ? ...rewrite removed — nothing in the suite covers the positioning the PR added the spacer for (that the counter lands on the end side when there is no supporting text to carryflex: 1).Also raised at this location by persona
react-native-paper: Counter-without-supporting-text fix is asserted by a test that passed before the change — On web RTL the only visible effect of the spacer is the counter's horizontal position, and the test renders with nodirand asserts existence only, so nothing in the checkout fails if the: hasCounter ? <View style={styles.addendumSpacer} /> : nullbranch is deleted. The added test therefore does not cover the change it names (PR bullet: "A counter with no supporting text is now pushed to the end side through a flexible spacer").persona:
react-native-paper,senior-developerUseful? Reply
@apex-sentinel-staging like, or@apex-sentinel-staging dislike <why>if it is not.Reply
@apex-sentinel-staging note ...to add context, or@apex-sentinel-staging pivot ...if it is wrong — I will re-check the cited code.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.
/like
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.
Thanks for the feedback. It helps us make these findings more useful.
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.
Done