-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[RNMobile] Adjust font sizes in RichText
based on device settings
#57055
Closed
Conversation
This file contains 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
With this commit, the logic for scaling the font size based on device settings has been separated out into its own function. This is to aid with overall readability.
SiobhyB
added
Mobile App - i.e. Android or iOS
Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Mobile App - Automation
Label used to initiate Mobile App PR Automation
[Type] Bug
An existing feature does not function as intended
labels
Dec 14, 2023
Size Change: -818 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in a934d41. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7224227883
|
Jest's environment returns pixel ratio, not font scale, when getFontScale() is called. It's therefore necessary to mock this method to return 1, the standard default for actual devices. Ref: https://reactnative.dev/docs/pixelratio#getfontscale
Some automated tests are failing, reporting that "fontSize={NaN}" is being added as a parameter to some blocks. Ref: https://github.com/WordPress/gutenberg/actions/runs/7216537798/job/19662900342?pr=57055 I found this is happening in cases where "currentFontSize" is "undefined", which this new function had not accounted for. With this commit, a check is added, so we continue to return "undefined" when there is no number associated with "currentFontSize".
As "10px" is often used by themes for a "small" font size, the minFontSize value has been updated to ensure users can still preview this within the editor.
As we're setting a minFontSize, it's necessary to update expectedFontSize in a few tests to match this new value.
Android automatically takes into account accessibility settings when displaying font sizes. If we add adjustments, it causes the font to look abnormally big on Android. As such, we can limit this function to iOS.
This was referenced Dec 17, 2023
SiobhyB
removed
the
Mobile App - Automation
Label used to initiate Mobile App PR Automation
label
Dec 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Mobile App - i.e. Android or iOS
Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
[Type] Bug
An existing feature does not function as intended
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.
Partial fix for: wordpress-mobile/gutenberg-mobile#4097
Related PRs
RichText
based on device settings wordpress-mobile/gutenberg-mobile#6465RichText
within Gutenberg wordpress-mobile/AztecEditor-iOS#1381RichText
based on device settings wordpress-mobile/WordPress-iOS#22242What?
RichText
component.Why?
How?
Testing Instructions
Screenshots or screencast
Android
Font size of 30px with largest available accessibility setting⤵️