Multi-reference editor 'Create new entry and link' dropdown won't work in an app
See original GitHub issueTo reproduce this:
- Clone https://github.com/kamsar/ctfl-multi-reference-embed-bug (specific repro code location)
npm run start
- In Contentful, add a private app pointed at
http://localhost:1338
, with a Entry field editor for Entry reference, list - Assign the app’s field editor to any Entry reference, list field. Ensure that more than one content type is allowed to be linked.
- Edit an entry with the custom editor. It will render correctly and work as a duplicate of the default multiple reference editor until you click
Create new entry and link
. Then the dropdown for content type selection becomes hidden and can’t be clicked.
The same view, but with sdk.window.startAutoResizer()
replaced with sdk.window.updateHeight(800)
to force a very tall iframe:
There are two issues here (and they’re probably closely related):
- The extension SDK’s
autoResizer
is not picking up the opening of the dropdown and resizing the iframe - This seems to be because the technique used to open the dropdown is also not updating any of the usual browser height detection properties, such as
document.body.scrollHeight
ordocument.documentElement.getBoundingClientRect()
all of which remain constant within the iframe whether the dropdown is open or not.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Default Multi Reference Editor | SAP Help Portal
The Default Multi Reference Editor allows you to select multiple references of another type. For example, you can use the Multi Reference Editor...
Read more >Creating Multi Reference Dynamic Pages in Wix | Wix Fix
In this video, you will learn how to create a multi-reference dynamic page. This will allow you to display specific items from a...
Read more >Working with Wix Data Multi Reference Fields - YouTube
Working with multi reference fields don't need to be a mystery. ... you can rapidly build, manage and deploy professional web apps.
Read more >Multi-reference field | Webflow University
Create a multi-reference field. The beauty of the reference and multi-reference fields is that whenever you edit an item that's being referenced, the ......
Read more >Referencing Multiple Items in One Collection Field | Help Center
A reference field creates a connection between an item in one collection and an item in a ... Select Reference or Multi-Reference as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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:
This results in:
Unfortunately it isn’t an applicable workaround for the actions menu dropdown on the individual entry cards.
The way I worked around this on one of our apps was as follows. However, it’s only useful in certain situations (see caveats):
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>
)AssetCard
as far as I know)ref
added in point 1) and callgetBoundingClientRect()
on it - you now have the dimensions of the absolute-positioned elementupdateHeight()
with the bounding box height, plus any offsets / padding / whatever you need to make it fithttps://user-images.githubusercontent.com/273311/144236000-d9085360-4948-464c-8983-d77de861e22f.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.