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

Fix: Font size select value mismatch #67309

Conversation

Takshil-Kunadia
Copy link
Contributor

Fixes: #67283

What?

The selected value gets updated in the font select after the next iteration. Thus leading to a lag in the correct value being displayed on the selector.

Why?

The state in store.getState() is updated after the setValue logic is completed. This results in the currentValue being out of sync with the state during the render cycle.

How?

There is no need for the current value to be fetched from the store created when we have the current value available as a prop. This PR makes the change of using that value directly instead of waiting for the store's value to be set and then fetch it.

Testing Instructions

  1. In local set-up, Open twentytwentyfive's theme.json. [ I have used this theme for demo, WP 6.8rc ].
  2. In the fontSizes object ( settings -> typography -> fontSizes ), add the following objects at the end.
				{
					"fluid": {
						"max": "4rem",
						"min": "3.2rem"
					},
					"name": "Extra Extra Extra Large",
					"size": "3.2rem",
					"slug": "xxx-large"
				},
				{
					"fluid": {
						"max": "5rem",
						"min": "4.2rem"
					},
					"name": "Extra Extra Extra Extra Large",
					"size": "4.2rem",
					"slug": "xxxx-large"
				}
  1. Open Global styles in site editor, and look for typography -> headings.
  2. Check the font size select drop down displaying the correct values for all the different headings selected.

Screenshots or screencast

Screen.Recording.2024-11-26.at.4.46.47.PM.mov

@Takshil-Kunadia Takshil-Kunadia marked this pull request as ready for review November 26, 2024 17:51
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Takshil-Kunadia <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: SainathPoojary <[email protected]>
Co-authored-by: mikemcalister <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@carolinan carolinan added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement. [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Nov 28, 2024
@Takshil-Kunadia Takshil-Kunadia force-pushed the fix/font-size-select-component branch from ceb9b2e to 2ae525f Compare December 24, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font picker not reflecting correct size with custom font sizes
2 participants