Skip to content

Fix URLPopover input handling to properly update value #70156

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

Merged
merged 1 commit into from
May 20, 2025

Conversation

im3dabasia
Copy link
Contributor

What?

Closes #70155

Why?

This PR fixes an issue where the URLPopover component was displaying "[object Object]" in the URL input field instead of the typed text. The problem was occurring because the onChange handler was incorrectly passing the entire event object to the state setter function instead of extracting the input value.

How?

The fix involves creating a proper event handler function that extracts the value from the event object before updating the state.

Testing Instructions

  1. Open WordPress Storybook (npm run storybook:dev)
  2. Search for "URLPopover" or navigate to the URLPopover story
  3. Click on "Edit URL" to open the popover
  4. Type in the URL field
  5. Verify that the text you type is correctly displayed and stored
  6. Submit the form and verify that the URL is correctly saved

Screencast

Before

Screen.Recording.2025-05-19.at.11.36.43.AM.mov

After

Screen.Recording.2025-05-19.at.11.35.09.AM.mov

@im3dabasia im3dabasia requested a review from ellatrix as a code owner May 19, 2025 06:12
Copy link

github-actions bot commented May 19, 2025

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: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

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

@Mamaduka Mamaduka added Storybook Storybook and its stories for components [Type] Bug An existing feature does not function as intended labels May 19, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @im3dabasia!

@Mamaduka Mamaduka added the props-bot Adding this label triggers the Props Bot workflow for a PR. label May 19, 2025
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label May 19, 2025
@Mamaduka Mamaduka merged commit b607274 into WordPress:trunk May 20, 2025
78 of 81 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.9 milestone May 20, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storybook Storybook and its stories for components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URLPopover: Input field displays "[object Object]" in Storybook
2 participants