Fix label display initialization in Forms #17519
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an easily reproducable bug in the forms input label display initialization: When you set an input[text] element´s label in a form that also contains a an input[submit], all label options will be hidden on load. This is really annoying, because users have to switch the input´s type to something else and back to text, so the eventListeners make the labels reappear.
Steps to reproduce:
The expected behaviour was that labeled input elements would display "label option" and "label text" on load.
There is an initialization problem when selectOptionsEditor.initilizeFieldType is called with the whole document passed in as wrapper. within that method, change event listeners are being attached to the type select elements. those listeners then use the whole document as parent for setting "d-none" classes. Therefore, the hide-logic gets applied to every label in the form.
Same issue exists within formElementLabelManager.
A simple fix is to only use the closest widget-editor-body as parent.
This pull request provides the described fix to this issue