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

Add documentation page for Popover component #1793

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Add documentation page for Popover component #1793

merged 1 commit into from
Nov 26, 2024

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Nov 22, 2024

Depends on #1792

Document the new Popover component introduced in #1791

image

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (54d82ea) to head (8b15cae).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1793   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           68        68           
  Lines         1220      1220           
  Branches       465       465           
=========================================
  Hits          1220      1220           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya mentioned this pull request Nov 22, 2024
2 tasks
@acelaya acelaya force-pushed the popover-docs branch 2 times, most recently from 1f9d03e to ff8094c Compare November 22, 2024 15:42
@acelaya acelaya marked this pull request as ready for review November 25, 2024 09:13
@acelaya acelaya requested a review from robertknight November 25, 2024 09:13
const [open, setOpen] = useState(false);
const buttonRef = useRef<HTMLButtonElement | null>(null);

useClickAway(buttonRef, () => setOpen(false));
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 added this because popovers handled via the popover API are automatically hidden when clicking away, which makes the open state no longer reflect reality.

I didn't notice this first because in the case of Select we have useClickAway, useFocusAway, etc.

I will address this separately, but we'll probably need to add an onClose callback to the Popover and handle a few native events, like toggle one.

Copy link
Member

Choose a reason for hiding this comment

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

I added this because popovers handled via the popover API are automatically hidden when clicking away, which makes the open state no longer reflect reality.

This seems like an obvious hazard that we should at least document.

I will address this separately, but we'll probably need to add an onClose callback to the Popover and handle a few native events, like toggle one.

Yes, definitely. Is there an issue tracking this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there an issue tracking this?

Done #1799

Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

The documentation generally looks good but I notice the examples don't work properly if the native popover API is not available, since there is no positioned container.

const [open, setOpen] = useState(false);
const buttonRef = useRef<HTMLButtonElement | null>(null);

useClickAway(buttonRef, () => setOpen(false));
Copy link
Member

Choose a reason for hiding this comment

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

I added this because popovers handled via the popover API are automatically hidden when clicking away, which makes the open state no longer reflect reality.

This seems like an obvious hazard that we should at least document.

I will address this separately, but we'll probably need to add an onClose callback to the Popover and handle a few native events, like toggle one.

Yes, definitely. Is there an issue tracking this?

@acelaya acelaya force-pushed the empty-closed-popover branch from 505c800 to 2f320de Compare November 26, 2024 08:39
Base automatically changed from empty-closed-popover to main November 26, 2024 08:42
@acelaya
Copy link
Contributor Author

acelaya commented Nov 26, 2024

I notice the examples don't work properly if the native popover API is not available, since there is no positioned container.

Good catch!

@acelaya acelaya merged commit 8fef71d into main Nov 26, 2024
4 checks passed
@acelaya acelaya deleted the popover-docs branch November 26, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants