Text inputs lose focus when panel is resized

Steps to reproduce:

  • insert the cursor into a text input so it had focus;
  • resize XD window’s height until the panel displays its scrollbar;
  • Text input loses focus.

The same also happens if a text input gain focus when the panel already has the scrollbar: it loses focus when panel is high enough to show all contents.

Expected behavior:
Text inputs keep their focus regardless of panel’s or application’s size.

What version of XD is this?

This is a known bug in older versions; don’t know if they fixed it in recent versions.

The problem is that focus is lost when UXP switches the panel from non-scrolling to scrolling.

The workaround is to make the panel always scrolling.

/* always scrollable to avoid the transition
 * from scrollable to non-scrollable, which
 * loses the input state */
panel {
  height: calc(100vh - 100px);
  overflow-y: scroll;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

@kerrishots discovered this for us some months back, and gave us the workaround.

But, yes, please fix for good, Adobe!

Both

54
and

thank you @cpryland, meanwhile I’ll try the workaround you’ve suggested.

Now it works.

My actual code:

container.style.position = "fixed";
container.style.top = 0;
container.style.bottom = 110;
container.style.overflowY = "scroll"; 

It seems it has also fixed the sticky footer issue.

Thank you @cpryland and @kerrishotts.

from https://medium.com/adobetech/whats-new-for-developers-in-adobe-xd-24-max-release-5cee8e3eea6f

  • Fixed cases where focus could be lost when a container transitioned from and to scrollable overflow states (macOS only).

On Mac it keeps losing focus without the above workaround.

1 Like