-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX TagField triggers edit form change without changes #251
FIX TagField triggers edit form change without changes #251
Conversation
8d53546
to
4cfcb0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works in an entwine context (such as on a blog page) - but it doesn't work in a react context (such as when the TagField
is inside an elemental block).
There are two ways you could approach this from here:
- Just reinstate the CMS 4 behaviour - i.e. tagfield input fields are always ignored.
- Remove all of the changes you've made
- in the
client/src/legacy/entwine/TagField.js
file make this change:- opts.ignoreFieldSelector += ', .ss-tag-field .Select :input'; + opts.ignoreFieldSelector += ', .ss-tag-field :input';
- Make this correctly detect changes in react
- Basically do what you have done, but don't add "no-change-track" in PHP or in the entwine code
- Handle all of the "no-change-track" classname stuff inside the react component itself
- Don't add "no-change-track" to the holder element at all, and in fact remove the
getChangeTrackerOptions()
section. Instead, just add or remove the "no-change-track" classname from the appropriate input component directly - Note that there are two
:input
fields in the react select component. You want to add the classname to both of them initially, and only remove it from the one that holds the actual value, not the one you type into. - you may need to refer to the react select docs for how to add class names to specific components within the select component.
Obviously option 1 is way easier, but option two is a slightly better user experience. I'll leave it to you to choose which you want to try.
I think it's bad idea. I suppose that it was made by mistake. Our user expect that all fields track changes, but it's annoying when they track changes for some field with ability to select options when user just start to typing. |
|
61c4369
to
67ec6eb
Compare
67ec6eb
to
efeb8b2
Compare
There are more deep problem then it can be covered by this task. Using TagFields in Elemental Area doesn't work at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works locally.
At some point in the future we'll probably want a cleaner approach we can use across multiple react components but for now since this is the only one that appears to need such a workaround, this will do just fine.
Description
The tag field input works differently than a simple text field and does not retain the new value after selecting or creating a new tag. Therefore, it is necessary to track the tag itself rather than typing in the input field. An additional method has been added that is called when a new tag is added or created.
Steps to reproduce the problem:
Steps to test:
Parent issue