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

[popups] Add data-closed style hook #882

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

atomiks
Copy link
Contributor

@atomiks atomiks commented Nov 27, 2024

Adds hidden to popup components' State, and when true (i.e. hidden is applied with keepMounted) it has a data-closed style hook.

@atomiks atomiks added the core Infrastructure work going on behind the scenes label Nov 27, 2024
@mui-bot
Copy link

mui-bot commented Nov 27, 2024

Netlify deploy preview

https://deploy-preview-882--base-ui.netlify.app/

Generated by 🚫 dangerJS against 93946eb

@atomiks atomiks marked this pull request as ready for review November 28, 2024 06:56
@@ -90,10 +90,11 @@ const AlertDialogPopup = React.forwardRef(function AlertDialogPopup(
const state: AlertDialogPopup.State = React.useMemo(
() => ({
open,
mounted,
Copy link
Member

Choose a reason for hiding this comment

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

Not strictly related to these changes, but this now becomes public API - I feel like "mounted" doesn't describe the behavior very well, especially when keepMounted = true. "visible" could be a better option.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps hidden to align with the DOM attribute that's being set?

Copy link
Contributor

Choose a reason for hiding this comment

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

visible sounds good too though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think hidden makes the most sense to align with the attr. visible adds yet another term to deal with

@@ -90,7 +90,7 @@ const AlertDialogPopup = React.forwardRef(function AlertDialogPopup(
const state: AlertDialogPopup.State = React.useMemo(
() => ({
open,
mounted,
hidden: !mounted,
Copy link
Member

Choose a reason for hiding this comment

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

Can we also use the same term internally?

Copy link
Contributor Author

@atomiks atomiks left a comment

Choose a reason for hiding this comment

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

The hidden value returned from useAnchorPositioning() refers to it being hidden but still mounted, which is when the anchor is hidden, so you want the popup to be hidden too.

Our prop is called hideWhenDetached, and we don't expose a style hook, simply using a functional style instead. I'm wondering if we actually should always expose a style hook and remove hideWhenDetached, so they can just use CSS and allows for further customization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants