mi6 / mi6/ic-ui-kit

[Any popover component]: Use portal concept to render popover elements

Open
#1,221 2 comments 0 reactions 0 assignees View on GitHub
component: ic-tooltip popover component search-bar component select component
Dominant language
TypeScript
Stars
53
Forks
63
Avg merge
2d 4h
Merged PRs (30d)
15

Description

## Summary
Use the 'portal' concept to render popover elements like ic-menu, popover-menu, tooltip (maybe?) so that the elements do not get cut off when the parent container is using an overflow.

## 💬 Description
At the moment, as the menu is usually a sibling or child of a parent component, the is a possibility it will be cut off when placed inside a container which uses overflow. 'Portals' is the concept of extracting the popover element out of it's sibling/child position and appending it to the body tag. This concept is available in the React ecosystem (https://react.dev/reference/react-dom/createPortal) but not readily available for web-components.

## 💰 Use value
This will improve the flexibility of any popover elements which are placed within containers which require overflow.

## 📝 Acceptance Criteria
If relevant, describe in full detail the different interactions and edge cases that the component or patterns needs to fulfil.

*Given that a select box is used within a dialog*
*When the select box menu appears*
*Then it should not be cut off by the parent container when it has an overflow: hidden or scroll*

*Given that popover element is rendered on the page*
*When it appears*
*Then the element should be taken outside of it parent element and rendered elsewhere in the DOM*

## ✏ Designs
N/A

##  🧾 Guidance
N/A

## Additional info
An example of where portals are being used for web-components is:
Vaadin: https://vaadin.com/docs/latest/example?path=component/datepicker/date-picker-basic.ts
- Note: When open, an additional overlay element is generated and appended to the body tag

Contributor guide

Open the contributing guide

Research direction

Start by locating the ic-menu, popover-menu, tooltip, select, and dialog components, then inspect how their overlays are currently placed relative to parent containers. Compare the behavior with the Vaadin date-picker example and define the shared portal approach; done means an open select or popover inside an overflow-hidden or scrollable container is rendered elsewhere in the DOM without being cut off.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.