Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

feat(FloatingMenu): support for specifying target container #1041

Merged

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Jun 28, 2018

This change makes <FloatingMenu> support an element to put the menu into,
which is, the ancestor of the trigger button with data-floating-menu-container attribute.

This change also removes code for React15-, which we dropped the support from 9.x codebase.

Refs carbon-design-system/carbon#910.
Refs carbon-design-system/carbon#911.

Changelog

New

  • New prop in <FloatingMenu>, target, which takes a function that returns the container the menu should be placed into
  • Code in <OverflowMenu> and <Tooltip> to pass along that new prop, both returning the ancestor of the trigger buttun with data-floating-menu-container attribute
  • A hidden <input> in dev env, to trap keyboard focus. With it, tab navigation of overflow menu closes the menu once the focus goes out of the menu

Removed

  • Code for React15- from <FloatingMenu>
  • Temporary element for createPortal() (Now createPortal() runs with actual target of the floating menu)

This change makes `<FloatingMenu>` support an element to put the menu into,
which is, the ancestor of the trigger button with `data-floating-menu-container` attribute.

This change also removes code for React15-, which we dropped the support from 9.x codebase.

Refs carbon-design-system/carbon#910.
Refs carbon-design-system/carbon#911.
Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

Awesome! This is a great enhancement, thanks for adding this in @asudoh! 🎉

Copy link
Contributor

@marijohannessen marijohannessen left a comment

Choose a reason for hiding this comment

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

Works great! 👍 ✅

@marijohannessen marijohannessen merged commit 4a92d3b into carbon-design-system:master Jun 29, 2018
@carbon-bot
Copy link

🎉 This PR is included in version 6.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asudoh asudoh deleted the floating-menu-target branch June 29, 2018 23:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants