-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat(PPDSC-2120): popover v1 #228
Conversation
- Add base component to support Tooltip and Popover - Move offset utils and tests to base component folder - Use base component for Tooltip - Create Popover component using base component - Add basic Popover tests and stories
You can preview these changes on: |
- Applying offset manually gives us more flexibility for overrides - But this is not compatible with the flip() middleware - Simplify distance override type (string) and use lib middleware - Update tests
- Use flip() and shift() middlewares to keep floating element within parent boundary - Add stories showcasing behaviour and for visual tests. Hard to test flip and shift in unit tests.
7acfd7d
to
74f8c06
Compare
- floating-ui/floating-ui#1741 - There is a bug in the lib that prevents setting to open by default in the uncontrolled case - Remove support for this prop and update tests / stories
- Icon buttons in popover stories must have aria-label attr - Only add aria-controls to the ref element if the popover is open
few more things from the ticket:
|
I clarified this with Mike M and he said we should not do this. See comments on the ticket: https://nidigitalsolutions.jira.com/browse/PPDSC-2120
I'd rather not add any more to this PR if that's ok. |
Thanks, I should have read the comments as well. Seems good |
- Focus shifts to panel (not entire Popover) on open. This is to prevent focus outline bugs on all browsers caused by the pointer rotation.
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.
Everything seems good to me, ready to approve it. just let me know when you fix your snapshots!
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.
LGTM
* feat(PPDSC-2120): mock useId to make tooltip tests less brittle * feat(PPDSC-2120): popover v1 - Add base component to support Tooltip and Popover - Move offset utils and tests to base component folder - Use base component for Tooltip - Create Popover component using base component - Add basic Popover tests and stories * feat(PPDSC-2120): use floating-ui offset middleware - Applying offset manually gives us more flexibility for overrides - But this is not compatible with the flip() middleware - Simplify distance override type (string) and use lib middleware - Update tests * feat(PPDSC-2120): add support for arrow padding * feat(PPDSC-2120): add flip and shift support - Use flip() and shift() middlewares to keep floating element within parent boundary - Add stories showcasing behaviour and for visual tests. Hard to test flip and shift in unit tests. * feat(PPDSC-2120): remove support for default open - floating-ui/floating-ui#1741 - There is a bug in the lib that prevents setting to open by default in the uncontrolled case - Remove support for this prop and update tests / stories * feat(PPDSC-2120): fix a11y errors - Icon buttons in popover stories must have aria-label attr - Only add aria-controls to the ref element if the popover is open * feat(PPDSC-2120): fix aria-dialog-name issue * feat(PPDSC-2120): fix firefox style overrides issue * feat(PPDSC-2120): hide non-test stories from applitools * feat(PPDSC-2120): remove duplicate content check from popover * feat(PPDSC-2120): remove unneeded props from tooltip * feat(PPDSC-2120): update pointer padding prop name * feat(PPDSC-2120): simplify px override logic * feat(PPDSC-2120): don't show warnings on prod * feat(PPDSC-2120): rename positions to placements in stories * feat(PPDSC-2120): update focus behaviour - Focus shifts to panel (not entire Popover) on open. This is to prevent focus outline bugs on all browsers caused by the pointer rotation. * feat(PPDSC-2120): allow pointer events inside popover * feat(PPDSC-2120): implement design review feedback * feat(PPDSC-2120): update theme snapshots * feat(PPDSC-2120): fix a11y story contrast issue
PPDSC-2120
What
I have done:
I have tested manually:
Differences to ticket:
defaultOpen
prop for Tooltip and Popover due to issue with 3rd party libaria-labelledby
to Popover floating element to preventaria-dialog-name
issue (also requires giving the reference element an id if it does not already have one).overrides.distance
must be a px stringpointer.padding
default / override so that the pointer does not reach the edge of the element (this looks strange with border radius applied).fallbackPlacement
tofallbackBehaviour
for clarity.