Fix repeatable text field focus#7499
Fix repeatable text field focus#7499sc0ttkclark merged 1 commit intopods-framework:release/3.3.8from
Conversation
PR Summary
|
|
The build files were included in the PR... maybe that's why build failed? The only real change was repeatable-field-list.js |
|
The original fix was to resolve problems reordering items. This will take a bit more work to cover both the original fix and resolving the issue with the value focus. Probably need to figure out a better way for the keys. |
48180ac to
fd75603
Compare
useEffect value-sync approach in repeatable DateTime, Currency, Text, and Number fields have been replaced with useRef. A previous fix for drag-and-drop reorder (including value in the React key) caused repeatable text fields to lose focus on every keystroke. Removing the value from the key fixed focus but regressed drag-and-drop for date/currency/number fields that maintain internal state. This replaces both approaches with useRef for persistent field IDs which associate with items during reorder. React tracks component instances without remounting, so text fields keep focus and fields keep their order.
fd75603 to
713efa7
Compare
|
Both drag & focus should be resolved now
Video: |
|
I'm experiencing the same issue with fields losing focus. Commenting to keep track of when this PR gets merged. |
|
I am also still having the issue with fields losing focus. |
e8f0839
into
pods-framework:release/3.3.8
Including value of text field in the field ID caused repeating text fields to lose focus as user typed.
Commit removes
JSON.stringify( valueItem )from input key.Description
Typing in repeatable text fields caused field to lose focus on each keystroke.
The react component was changing input field key with value, causing the field identifier to change as user typed.
Related issue(s)
https://wordpress.org/support/topic/plain-text-repeatable-fields-lose-focus-when-typing/
Testing instructions
Create a repeating text field
Add new
Type in field
Save
Should be able to type more than one character in field and save the value.
The last working version was
3.3.4:pods/ui/js/dfv/src/components/field-wrapper/repeatable-field-list.js
Line 218 in f5cd00f
This change brings it back to how it was in that version, but it is notable that as I switched between versions, the values displayed in the field appeared to be lost, so unknown if there's any backend change needed or reason the key was changed.
Changelog text for these changes
Fix: Repeatable text field input
PR checklist