Skip to content

Add WithCloseHandlers story #69688

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 11 commits into from
Apr 10, 2025

Conversation

Rishit30G
Copy link
Contributor

@Rishit30G Rishit30G commented Mar 25, 2025

What?

Closes #69675

Why?

This PR is necessary to add functionality for onClose and onFocusOutside

How?

This PR adds a new story WithCloseHandlers which will showcase the functionality of onClose and onFocusOutside

Testing Instructions

  • Run npm run storybook:dev
  • Search for Popover story
  • Visit the WithCloseHandlers story to check the onClose and onFocusOutside functionality

Screencast

Screen.Recording.2025-03-26.at.1.37.46.PM.mov

@Rishit30G Rishit30G marked this pull request as ready for review March 26, 2025 08:15
@Rishit30G Rishit30G requested a review from ajitbohra as a code owner March 26, 2025 08:15
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: Rishit30G <rishit30g@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>

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

@Rishit30G
Copy link
Contributor Author

@ciampo please review this PR whenever you have time. Thanks!

@t-hamano t-hamano added [Type] Developer Documentation Documentation for developers [Package] Components /packages/components Storybook Storybook and its stories for components labels Mar 27, 2025
@ciampo ciampo requested a review from a team March 28, 2025 16:08
@@ -255,3 +258,94 @@ export const WithSlotOutsideIframe: StoryObj< typeof Popover > = {
...Default.args,
},
};

export const WithCloseHandlers: StoryObj< typeof Popover > = {
decorators: [
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally speaking, I'd like to understand if we can abstract the decorator to avoid reperition with the default story — although it's definitely not a priority at the moment, let's first get the new example to look & work as expected.

@Rishit30G
Copy link
Contributor Author

Thanks for the extensive review @ciampo! I'll work on them 🙇‍♂️

@Rishit30G Rishit30G requested a review from ciampo April 4, 2025 05:50
@Rishit30G
Copy link
Contributor Author

Updated the PR 👍🏻

@Rishit30G Rishit30G requested a review from ciampo April 7, 2025 06:01
@Rishit30G Rishit30G requested a review from ciampo April 8, 2025 03:34
@Rishit30G Rishit30G requested a review from ciampo April 8, 2025 13:46
Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Thank you for your patience iterating over this!

Code changes LGTM, we just need a CHANGELOG entry and then we'll be able to merge 🙏

@Rishit30G
Copy link
Contributor Author

Will update the changelog in the packages/components/CHANGELOG.md

@Rishit30G
Copy link
Contributor Author

Updated the CHANGELOG.md

@Rishit30G Rishit30G requested a review from ciampo April 8, 2025 14:18
@Rishit30G Rishit30G requested a review from ciampo April 8, 2025 17:01
@ciampo ciampo merged commit 37dd713 into WordPress:trunk Apr 10, 2025
61 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.7 milestone Apr 10, 2025
@ciampo
Copy link
Contributor

ciampo commented Apr 10, 2025

Thank you, @Rishit30G !

As a follow-up, it would be great to try to refactor Popover stories to remove some duplication between the newly added story and existing ones — in case you have capaticy to work on it

@Rishit30G
Copy link
Contributor Author

Thanks @ciampo for your proactive reviews and feedbacks! 💯

As a follow-up, it would be great to try to refactor Popover stories to remove some duplication between the newly added story and existing ones — in case you have capaticy to work on it

Well noted 📝
Please find the issue and PR linked here: #69878

@Rishit30G
Copy link
Contributor Author

Thank you for your patience iterating over this!

Likewise 👏🏻 👏🏻

chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
* Add WithCloseHandlers story

* Add focusOnMount

* Update popover size and layout

* Fix: replace decorator with render function

* Modify event handlers and render functions

* Refactor close and focus outside handlers in Popover story

* Refactor event handler types and text in Popover story

* Update focusOnMount argument

* Add changelog and update focusOnMount props

* Update changelog

---

Co-authored-by: Rishit30G <rishit30g@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components Storybook Storybook and its stories for components [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Popover: improve Storybook examples around onClose and onFocusOutside props
3 participants