-
Notifications
You must be signed in to change notification settings - Fork 153
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(Popover): popover content now closes on ESC key press #4557
base: master
Are you sure you want to change the base?
Conversation
Storybook staging is available at https://kiwicom-orbit-sarka-popover-esc-close.surge.sh |
Size Change: +11 B (0%) Total Size: 459 kB
ℹ️ View Unchanged
|
7e5c738
to
fcb64e7
Compare
Deploying orbit with Cloudflare Pages
|
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.
Key Issues
The else
block in handleOut
incorrectly closes the popover when interacting with its internal content, disrupting expected behavior by not distinguishing between clicks inside and outside the popover.
} else { | ||
setShown(false); | ||
} |
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.
🐛 Possible Bug
The new else
block in handleOut
will close the popover when clicking inside it, which breaks the expected behavior. The popover should only close when clicking outside (!ref.current.contains(ev.target)
) or when explicitly triggered. The current implementation will make the popover close when interacting with any content inside it, including buttons or form elements.
} else { | |
setShown(false); | |
} | |
} else if (typeof opened === "undefined" && onClose) { | |
onClose(); | |
} |
867771b
to
a565143
Compare
a565143
to
002b225
Compare
closes https://kiwicom.atlassian.net/browse/FEPLT-2185
This Pull Request meets the following criteria:
For new components:
d.ts
files and are exported inindex.d.ts
✨
Description by Callstackai
This PR adds functionality to close the Popover component when the ESC key is pressed, along with visual regression tests for this feature.
Diagrams of code changes
Files Changed