Popup always scrolls to input field

I have a Popup for each Project object type in my app, which is meant to show a photo gallery, with the photos at the top. At the bottom of the Popup is an Input field for adding comments.

When I open a Project Popup I expect the Popup to stay at the top, so I can see the photos, however on both Desktop and Mobile, the Pop-up initially open at the top, then immediately scrolls down to the Input, which seems to be focussed.

Is there some way to force the Pop-up to stay at the top?

Video of isssue here.

I would use Scroll To action, but since the Element I want to view is in a Reusuable Element, which is viewed in a Popup - I donā€™t seem to be able to reference it.

Do you have a process that ā€œFocus on inputā€ when popup open?
Did you try to add scroll to directly to popup (When popup openā€¦)

There is no Focus on Input.

Problem is I have to run the Workflow on the Resuable Element itself, which is in the Popup, so I canā€™t refer the Popup opening itself as the trigger, as I canā€™t reference it from the Reusable element.

So I found this 'Do When CustomDefinition is Visible" and set it to run every time. I thought it had done the trick, but somehow the first few times I open a Popup it will now Scroll to the Featured Image, but after maybe the 3rd click, it starts scrolling again to the Input (which is Focussed).

See video of this.

Is the input a plugin?
The main issue I can see here is the ā€œautoā€ focus on input.

1 Like

Nope - itā€™s a normal Multiline input. There is definitely no Focus being triggered either.

This seems to be a Bubble issue: Autofocus Input Do NOT Do

The solution in that thread is a visual hack (remove the focus styling) and would not help me.

It seems my Hack above - to Scroll to the Featured Image, works a few times, then Bubble takes over and starts scrolling back to the ā€œfocussedā€ Multiline Input.

OK, this is a bit bonkers, but on Desktop I can solve the issue but putting a 1x1 pixel Multiline Input underneath the Featured Image that I actually want to see. Then my Feature image is always in focus because it is Scrolled too, either because of the Workflow, or because the desktop will scroll to the Input.

It breaks the layout on mobile though, so isnā€™t a solution.

At what point is something considered a Bubble bug?

I contacted Bubble support, and they confirmed this is expected behaviour. :confused:

The person who replied to me said they had put in a feature request to make this behaviour optional, but I canā€™t imagine my request will be anywhere near the top of the pile of work-to-do. :pensive:

1 Like

@major_groove I just experienced this issue with a popup and a comments section in the popup. I fixed it by adding a 1x1 input at the top of the popup and setting focus to that input in the workflow that opens the popup

You are right - that is the only solution. Problem is you get left with this 1x1 focussed input which is visible. @Jici has a plugin that hides the focussed input though.

Itā€™s still stupid default behaviour. Would be nice if Bubble just fixed it.

Just ran into this issue too - have no idea why a set-focus is the default behavior for a popup.

Running into problems on mobile because a set-focus opens up the keyboard and covers half screen.

@wesfrank
this is a known behavior and I donā€™t think Bubble plan to change that.

Iā€™ve created something for @major_groove . Can you confirm that the solution is working for you?

Thanks

2 Likes

Yup it is still working for me.

Ridiculous default behaviour. Iā€™ve already mentioned it to Bubble. @eve just FYI again.

Now available:

1 Like

I was able to figure out another workaround. I made the input field hidden on page load and then in my workflow to show popup I inserted Add a pause before next action of 500ms then put a show element action in the workflow to show the input element. I tried shorter than 500ms but 500ms seems to be the trick. This makes it so the keyboard doesnā€™t open and it shows the entirety of the popup as if there were no input element. There is one more step that you have to add to keep this fluid. You have to add a workflow that re-hides the element when you complete, close or exit out of your popup so the input element is hidden again for the next time you open the popup. This has been working for me so far. Hope it helps.


2 Likes

I found a fix.
I put the input box inside of a Group and it stopped focussing when the popup opens.

2 Likes

Found an even easier solution for thisā€¦
If you want the focus of a popup to be anywhere, simply place a 1px x 1px DROPDOWN and then use the ā€œSet Focusā€ workflow to this hidden dropdown.
The big difference with using the dropdown is it does not trigger the phones to display their keyboards.
Hope this helps.