Closed wimbarelds closed 1 month ago
Hi @wimbarelds ,
Thanks for reporting this issue, it has been fixed as part of React SDK 24.1.10 version and you can check the changes in this PR: https://github.com/pegasystems/react-sdk-components/pull/363
Thanks, Siva
Describe the bug We have form elements inside of a FieldGroupTemplate. When a form-field inside of this FieldGroupTemplate is changed and you hit the
[Tab]
button, the form completely loses focus.To Reproduce Steps to reproduce the behavior: We have form elements inside of a FieldGroupTemplate. When a form-field inside of this FieldGroupTemplate is changed and you hit the
[Tab]
button, the form completely loses focus.Expected behavior When I hit tab, I expect the next element in the form to receive focus.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
After digging into why this is happening I have found the following:
The
createPConnectComponent
function creates a new class-component every time it is executed, as a result when you have a component that uses this function (such as FieldGroupTemplate or Reference); when the component re-renders, andcreatePConnectComponent
is executed again, React views the resulting JSX as completely new- because the rendered component is "different".Because the JSX is seen as new, this means the HTML element which had focus is removed from the DOM and replaced with a new element (instead of updated).
If I edit
node_modules/@pega/react-sdk-components/lib/bridge/react_pconnect.js
, and move the class definition outside of the function; the issue goes away completely.