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

Refactor CSS to fix various namespace clashes and improve compatibility with newer Bootstrap CSS libraries #1433

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

lucasnetau
Copy link
Collaborator

FormBuilder has an embedded Bootstrap 3 stylesheet which can cause clashes with HTML elements outside of the formBuilder and formRender containers.

This PR does some refactoring of the style and introduces a modification to an option flag to selectively disable Bootstrap 3 styles into the form.

Refactoring: Move classes under the .rendered-form and .form-wrap.form-builder containers. This ensures we are only setting styles for Elements within our container.

Fixes #594
Fixes #727

Refactoring: Tooltips styles de-duplicated and moved under their own includable scss file to share between form-render and form-builder

Feat: By moving the embedding of Bootstrap 3 styles under an enabling class .formbuilder-embedded-bootstrap we can selectively disable those styles by removing that class. This can be done by setting disableInjectedStyle to 'bootstrap', effectively changing disableInjectedStyle from a boolean to a boolean|string option. As disableInjectedStyle defaults to false, the Bootstrap classes will be embedded

Testing has shown no oddities on either Builder nor Render.

…cing the scss into an included file under the respective container
…aced css selectors under .form-wrap.form-builder. Consolidate two definitions for .toggle-form.
…aced css selectors under .rendered-form
…d Bootstrap 3 classes while allow the formBuilder styles to be included.

This was done by move the embedded Bootstrap 3 classes under an enabling parent class '.formbuilder-embedded-bootstrap'. This class is set by default by both formRender and formBuilder, it can be removed by setting `disableInjectedStyle` to 'bootstrap'. This allows for including Bootstrap CSS libraries directly into the page via stylesheets and not have any clashes with the embedded version which is especially important when trying to work with Bootstrap 4 and 5.
Copy link
Owner

@kevinchappell kevinchappell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes look good to me

@kevinchappell kevinchappell merged commit 267fb17 into kevinchappell:master Oct 6, 2023
@github-actions
Copy link

github-actions bot commented Oct 6, 2023

🎉 This PR is included in version 3.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lucasnetau lucasnetau deleted the css_updates branch October 15, 2023 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

same class name problem ("form-group") formBuilder seems to be too liberal in re-styling basic types
2 participants