Skip to main content

Troubleshoot: Widget Fields Not Responding Inside Modals

How to fix Userback widget fields you can't click or type into when the widget is opened over a modal or dialog.

Written by Jon

Many UI libraries "trap" keyboard and mouse focus inside an open modal, so nothing outside it can be used. The Userback widget sits outside your modal, so its fields look greyed out or ignore clicks and typing.

Turn off focus trapping

Find the modal component the widget is opened over, and turn off its focus trap. The setting is usually called something like "trap focus", "enforce focus", or "retain focus".

  • Material UI: set disableEnforceFocus on the Modal or Dialog. See the Material UI Modal API.

  • Vuetify: set retain-focus to false on the dialog. See the Vuetify dialog documentation.

  • Other libraries: look for a similar option in the modal's documentation.

Save the change and check that you can type in the widget while the modal is open.

Check z-index and pointer events

If turning off the focus trap doesn't help:

  • Check your modal's z-index isn't set so high that it covers the widget.

  • Check the <body> element doesn't have pointer-events: none; applied while the modal is open.

These Radix UI threads discuss the same problem: focus issues and focus and z-index.

Browser extension and Bootstrap modals

Bootstrap modals pull focus back into the modal whenever you click elsewhere. When you use the Userback widget code, Userback detects Bootstrap and stops this for you. The browser extension runs separately from your page, so it can't.

To fix it for the extension, turn off Bootstrap's focus behavior in your code.

For Bootstrap 3 and 4:

$(document).off('focusin.bs.modal');

For Bootstrap 5, set the modal's focus option to false.

Related articles

Did this answer your question?