material-components-web icon indicating copy to clipboard operation
material-components-web copied to clipboard

[MDCList MDCDialog] FocusTrap throws an error

Open florenso opened this issue 2 years ago • 0 comments
trafficstars

Bug report

I am trying to get a simple dialog to work with a preselected item. it works propperly but still throws an error. It looks like a bug but i might be doing something wrong.

Steps to reproduce

  1. Go to https://codepen.io/florenso/pen/rNrWOEa
  2. Open chrome devtools console (the console of codepen does not show the error)
  3. Click on the button to open the dialog
  4. See error

Actual behavior

thows error: material-components-web.min.js:1 Uncaught Error: FocusTrap: Element must have at least one focusable child. at r.trapFocus (material-components-web.min.js:1:26219) at Object.trapFocus (material-components-web.min.js:1:376068) at material-components-web.min.js:1:169218

Expected behavior

no error

Your Environment:

Software Version(s)
MDC Web 14
Browser brave (chromium)
Operating System windows 10

Additional context

The console in codepen does not show the error, only the console of crome. it only happens the first time. when you select an item and open the dialog again it works as expected.

florenso avatar Jan 05 '23 14:01 florenso