Comments (7)
@kamsar, I encountered this same issue. It is because the dropdown containers use fixed
positioning. Subsequently the iframe height calculations do not take the dropdown dimensions into account.
It is related to #188 and also impacts the action menu dropdown, which leverages the same container and positioning. The bottom dropdown, (or otherwise long actions menus), will always get cut off by the iframe.
Specifically regarding the Create new entry and link action, I was able to produce a quick and dirty workaround by overriding the styles to force the container to be static positioned:
.DropdownContainer__DropdownContainer___3WlJM[data-test-id="add-entry-menu-container"] {
position: static !important;
display: inline-block !important;
margin-top: 5px !important;
}
Unfortunately it isn't an applicable workaround for the actions menu dropdown on the individual entry cards.
from field-editors.
This fix makes the dropdown at least usable without a hack but it's not particularly nice of an experience. The popper dropdown is absolutely positioned using transform: translate(0px, iframeHeightpx)
, which still does not affect the document height calculations.
After click - now you get scrollbars, but the menu is not visible without scrolling - to a non-technical user, that's not very obvious especially since the text does not indicate a menu is open via icon change, etc:
After scrolling down within the iframe, you can use the menu:
User-experience wise the hack we were using with the old menu was actually a lot better, as autoresizer worked with it.
For anyone looking for an updated hack that works with the new version, this does the trick when we negate the transform
:
.DropdownContainer__DropdownContainer___3WlJM[data-test-id="add-entry-menu-container"] {
position: static !important;
display: inline-block !important;
margin-top: 5px !important;
transform: none !important;
}
from field-editors.
The way I worked around this on one of our apps was as follows. However, it's only useful in certain situations (see caveats):
- Create a
ref
on the absolute-positioned element which overflows the iframe (caveat: this is only possible if the component lets you pass aref
obviously, such as using a Forma 36<DropdownList>
) - Create an event handler for any event which causes the overflowing element to appear (caveat: again, this is only possible if you have control over when the element is displayed - for example, you can't add a callback to get notified when the user opens the dropdown on an
AssetCard
as far as I know) - In the event handler above, grab the element reference (the
ref
added in point 1) and callgetBoundingClientRect()
on it - you now have the dimensions of the absolute-positioned element - From there it's simply a case of turning off the window auto-resizer and calling
updateHeight()
with the bounding box height, plus any offsets / padding / whatever you need to make it fit - When the element is hidden again, make sure to restart the window auto-resizer
Screen.Recording.2021-12-01.at.12.26.35.mov
The results still aren't perfect - obviously the dropdown is causing the whole iframe to grow, rather than just appearing over the field below it, but there are limits to what HTML can do 😄 This was good enough for our use case - to be able to dynamically adjust the height of the iframe to encompass the (variable-length) dropdown items without clipping/scrolling.
from field-editors.
Experiencing the same issue.
The above fix solves it for me.
from field-editors.
@kamsar @knupska @matt-koevort We're working on the fix for this issue. We're about to release a new version of field-editors with the latest Forma36 under the hook that should resolve the issue.
from field-editors.
"@contentful/forma-36-react-components": "^3.100.2",
:
from field-editors.
Marking issue as stale since there was no activity for 30 days
from field-editors.
Related Issues (20)
- @contentful/field-editor-rich-text re-rendering problem HOT 6
- Default Field Editors does not recognize `Link` field type HOT 2
- Rich text editor not rendering HOT 2
- Short Text Radio Field - No Margin for RTL Languages HOT 1
- p-queue is used in default-field-editor but not installed as a dependency HOT 1
- RichTextEditor value and onChange props HOT 9
- Inline language tagging in rich text HOT 1
- Update lerna to latest HOT 2
- Is it possible to use Contentful Rich Text Editor separately HOT 3
- Option to completely disable Richtext Commands dialogue box from 'field-editor-rich-text' HOT 1
- Issue with react-sortable-hoc and React 18 HOT 3
- Rich Text Commands ignores linkContentType restriction HOT 1
- Markdown editor losing focus randomly while typing HOT 10
- Rich-Text-App Start "isValidImage" error HOT 2
- How to display a custom app within an entrty? Widgetnamespace = 'app' HOT 5
- This package is not working in Next.js project HOT 3
- Json field error HOT 2
- Entry is missing or inaccessible HOT 1
- Default field editors do not look like the latest Contentful UI HOT 4
- Attempted import error: 'File' is not exported from './typesEntity'. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from field-editors.