Skip to content
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

Entwine TreeDropdownField styling broken #377

Closed
2 tasks done
tractorcow opened this issue Dec 8, 2017 · 1 comment
Closed
2 tasks done

Entwine TreeDropdownField styling broken #377

tractorcow opened this issue Dec 8, 2017 · 1 comment

Comments

@tractorcow
Copy link
Contributor

tractorcow commented Dec 8, 2017

Styling of all tree dropdown fields in the pages setting form is messed up

image

Pull requests

The issue is caused by this code:

// shifts the react component to override the entire field holder element
if (this.parent('.form__field-holder').length) {
    this.unwrap('.form__field-holder');
    this.siblings().remove();
    this.unwrap('.form-group').attr('class', 'TreeDropdownField form-group');
}

The problem is that this incorrectly mangles the DOM classes.

Expected dom:

image

Actual dom:

image

Instead of flipping the dom inside out, can't you just attach the component to the outer html?

-const container = this[0];
+const container = this.parent('.form__field-holder')[0];
      if (container) {
        ReactDOM.unmountComponentAtNode(container);
      }
@flamerohr
Copy link
Contributor

Instead of flipping the dom inside out, can't you just attach the component to the outer html?

You lose the schema data on the div inside the field holder then...

I guess I don't prefer a destructive approach if possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants