lion icon indicating copy to clipboard operation
lion copied to clipboard

Adding autofocus to lion-input/lion-button inside lion-dialog will give Maximum call stack size exceeded error

Open rsmit-ing opened this issue 4 years ago • 0 comments

Expected behavior

When having multiple dialogs (with a styled-dialog-content element inside) inside 1 component and opening them sequentially, I would expect the input I put the "autofocus" attribute on to grab focus, but this is not the case.

Actual Behavior

Nothing happens and I get an error in the console; Uncaught RangeError: Maximum call stack size exceeded. at setFocusInRootElement (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:156) at handleFocusin (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:162) at setFocusInRootElement (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:156) at handleFocusin (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:162) at setFocusInRootElement (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:156) at handleFocusin (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:162) at setFocusInRootElement (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:156) at handleFocusin (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:162) at setFocusInRootElement (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:156) at handleFocusin (:8081/node_modules/@lion/overlays/src/utils/contain-focus.js:162)

Additional context

-On some of the inputs/buttons it will give the error, on others it will only call focus about 50 times and therefore not give the error (checked using breakpoints and modifying with console.log) -This also happens when calling focus() directly on the element -I've not managed to reproduce the error in storybook or webcomponents.dev, so it might have something to do with the immense number of parents of the application I'm doing this in.

rsmit-ing avatar Jan 11 '22 15:01 rsmit-ing