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

OEP-16: Bootstrap Adoption #46

Merged
merged 4 commits into from Jun 19, 2017
Merged

OEP-16: Bootstrap Adoption #46

merged 4 commits into from Jun 19, 2017

Conversation

andy-armstrong
Copy link
Contributor

@andy-armstrong andy-armstrong commented Apr 21, 2017

This is the first draft of a proposal for Bootstrap adoption.

You can see the rendered proposal here:

https://github.com/edx/open-edx-proposals/blob/1fb54d1491fea382521bdec717d1e28f20c3a1cf/oeps/oep-0016.rst

FYI @edx/fedx-team @ormsbee @clintonb @efagin @douglashall

Copy link

@clintonb clintonb left a comment

Choose a reason for hiding this comment

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

This is great.

Implementation note: It would be ideal if we created our own npm package (e.g. edx-bootstrap) that has the Sass files ready to go. The package would allow us to start using this for IDAs in addition to edx-platform.

New Bootstrap themes will be implemented in the `edX UI Toolkit`_. These themes
will be provided as Sass partial files that can be included into any project's
Sass file. The files will be as follows:
* A partial defining the standard edX fonts, layouts, margins etc

Choose a reason for hiding this comment

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

Add a new line before this one so the RST renders properly.

* This file included all of the course-specific Sass partials
* Any global-level rules were excluded to allow Bootstrap's styles to be used

See the `Bootstrap Proof-of-Concept PR`_ for more details, including screenshots

Choose a reason for hiding this comment

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

We should also do a proof-of-concept for theming for both single and multi-tenancy. Theming for a single tenant is relatively easy, but not so much for multiple tenants as evidenced by the fact that we still haven't settled on a single method of theming:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd love to talk to you more about theming, as I'm only familiar with comprehensive theming in edX platform. For that, there is already a separate Sass file per site, so I was thinking that each file would just include its own Bootstrap theme partial. Let's get together with @douglashall, @gsong, and other interested theming folks to come up with a consistent approach.

@andy-armstrong
Copy link
Contributor Author

Thanks, @clintonb. I should have been more explicit how I see IDAs working with this, so I'll revises this section. The UI Toolkit is an npm package which any IDA can install, and my proposal is to include the Bootstrap theme Sass files in this package. We discussed having a separate repo, but that seemed like overkill for what we currently see as only being three files. In addition, the reusable React components that @arizzitano and @bjacobel are working on will be published from the UI Toolkit too, so we figured that every IDA will already be including it. Let me know if this seems reasonable to you, or if you see benefits to introducing another npm package.

@OmarIthawi
Copy link
Member

OmarIthawi commented Apr 23, 2017

@andy-armstrong I think it's a good step to include Bootstrap as a foundation for new Open edX features and eventually migrate the existing ones as well.

There's a huge caveat. Bootstrap doesn't support RTL by default, despite various (low quality?) attempts. The Bootstrap team is planning to support RTL once a v4 is out.

I'm more than happy to help on this regard.

@andy-armstrong
Copy link
Contributor Author

Thanks, @OmarIthawi. I forgot to add that @bjacobel did an investigation about RTL here: https://openedx.atlassian.net/wiki/display/FEDX/Bootstrap+spike+findings. We're currently thinking of using https://www.npmjs.com/package/postcss-rtl. I'll add this in my next draft.

@OmarIthawi
Copy link
Member

OmarIthawi commented Apr 23, 2017

@andy-armstrong. Thanks for pointing out to the spike findings. I'll share more about my experience in making RTL interfaces.

RTL support might seem to be perfectly automatable, in fact it has a lot more complications that just flipping some margins here and there. Consider the following example that process-all tools like postcss-rtl won't support:

  • Flipping font and SVG icons.
  • Showing the same video player regardless of the direction (it's a famous acceptable LTR use in RTL context).
  • Avoid flipping and corrupting logos and branding in general.
  • Yet, require flipping the decorations and any page visuals.
  • JavaScript and CSS RTL support? This really requires the touch of an artist to provide an elegant support.

I'm not trying to make another anti-automation lost case. The goal here is point out few lessons learned from my humble experience trying to build RTL websites for the past 10 years. I've attempted the following:

  • Copy and Modify: Duplicate the LTR file to RTL and make minor changes. The result is very costly maintenance.
  • RTL Overrides: Create another file with the RTL overrides only. Very costly maintenance as well.
  • CSS Post Processing Tools: Requires a lot of manual post processing, and it often makes the incorrect guesses.
    • This one reminds me of Python2's implicit Unicode to/from str conversions.
    • Theoretically less upfront cost. Except when the tool behaves incorrectly. However, it's not clear when bugs are expected, and no clear way to fix it.
  • Bi App Sass: Love from first sight! It works just fine. However, one have to be conscious about the CSS, and make explicit RTL rules.
    • More like what Python3 did for str to/from bytes conversion. It requires some work, but the result is always predictable.
    • Upfront cost, in favor of lightweight maintenance overhead.

Please let me know if we should move the RTL tooling to another thread/OEP.

Copy link

@bjacobel bjacobel left a comment

Choose a reason for hiding this comment

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

Some nitty comments in my review; also wanted to address two other ongoing discussions here:

RTL
Sounds like @OmarIthawi has quite a bit of experience with all of the different options for doing this. In the small proof-of-concept I did automatically flipping rules worked quite well - we were even able to set up exclusions with preprocessor directives so e.g. code blocks weren't flipped - but it's very possible that the PoC wasn't complex enough to run into a lot of the edge cases. To me it seems like something that can be automated, but maybe nobody out there has built a sufficiently good system for doing it in an automated way yet, so we shouldn't recommend that path. Maybe more investigation of these capabilities is needed. Either way, bi-app-sass works fine and I don't hear many complaints using it - people just forget to use it when they need to sometimes.

where to put this stuff
I've changed my mind on this slightly since we first talked about this idea - I now agree with @clintonb that our Bootstrap theme and related files should live in their own repository, not in edx-ui-toolkit. Separating these concerns makes semantically versioning each independently possible and makes it clearer what each is for / lower-impact to implement. It will be a repo with only ~3 files in it, but repos are free and so are NPM packages :)

========

In order to accelerate development, and provide a more consistent user
experience for our users, edX will adopt Bootstrap 4 to build all of its web

Choose a reason for hiding this comment

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

build

"style" or "theme" might be a more appropriate word here? Nitty semantics but it's also the thesis of the OEP so I want to make sure it's clear.

* internationalization and right-to-left languages
* theming
* performance
* mobile-first responsive designs

Choose a reason for hiding this comment

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

"Mobile-first" and "responsive" to me are two different things. I don't know which one we're adopting but we should clarify this terminology, as they have different goals and outcomes.

* integration with build systems
* integration into existing edX pages

Bootstrap is the industry standard web framework with a comprehensive collection

Choose a reason for hiding this comment

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

web framework

Would "design framework" be a better term for it? "Web framework" to me makes me think of Django, Rails, etc.

Bootstrap is the industry standard web framework with a comprehensive collection
of web components. Each of these components is designed to be mobile-first,
meaning that Bootstrap applications look good at phone, tablet, and desktop
sizes.

Choose a reason for hiding this comment

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

Each of these components is designed to be mobile-first, meaning that Bootstrap applications look good at phone, tablet, and desktop sizes.

Back to my comment above - this to me is a description of "responsive." "Mobile-first", in my mind, signifies that it's designed with handsets as the primary use case and scales to work on desktop but desktop remains a secondary use case.

Examples: The Boston Globe is responsive, because everything works generally equally well across all platforms. Facebook is mobile-first because everything important happens in a core content area of ~500px and the layout doesn't really make full use of the full desktop real estate. Some features only work on mobile and it's clear that the interaction model (the same one you get regardless of the platform you view FB on) is designed with touch input and small screens in mind.

Copy link

Choose a reason for hiding this comment

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

@bjacobel -- agree on the mobile-first comment. It's about the implementing for the primary use case and thinking of all other cases are exceptions.

Copy link

@dsjen dsjen left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together and for all the discovery. Excited to use bootstrap 4!

* extensibility / ease of overriding
* modularity / scoping
* Open edX community interest
* size and activity of the framework's community?
Copy link

Choose a reason for hiding this comment

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

Is the "?" here to indicate this goal might be cut? It seems to be by the rubric item, "Community project support."

Bootstrap is the industry standard web framework with a comprehensive collection
of web components. Each of these components is designed to be mobile-first,
meaning that Bootstrap applications look good at phone, tablet, and desktop
sizes.
Copy link

Choose a reason for hiding this comment

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

@bjacobel -- agree on the mobile-first comment. It's about the implementing for the primary use case and thinking of all other cases are exceptions.

@andy-armstrong
Copy link
Contributor Author

@OmarIthawi @clintonb @dsjen @bjacobel et al, thank you for your excellent review comments. Here's where I think we stand right now:

  • I agree with the recommendation that we have a separate edx-bootstrap repo rather than conflating it with edx-ui-toolkit.
  • We need to reach a common understanding as to how to handle RTL support, given that Bootstrap does not yet have a recommended approach. I'm doing a discovery story this sprint: https://openedx.atlassian.net/browse/FEDX-352

Once we've determined an approach to RTL, I will publish a second draft of this OEP to cover these two topics plus the other feedback on this PR.

@andy-armstrong
Copy link
Contributor Author

@dsjen @nasthagiri - @efagin suggested both of you as potential arbiters for this OEP. I'm going to publish a second draft today, so would either of you like to volunteer? Thanks!

@dsjen
Copy link

dsjen commented May 17, 2017

@andy-armstrong -- I'm happy to be arbiter!

@andy-armstrong
Copy link
Contributor Author

@OmarIthawi @clintonb @dsjen I've published my second draft based on all of your feedback, and the results of the discovery story for right-to-left support. I'd love your feedback when you have some time.

@dsjen
Copy link

dsjen commented May 17, 2017

@edx/fedx-team & @cptvitamin (and others) -- I wanted to check in and see if you have any feedback or questions about this OEP for adopting bootstrap. We're looking to gather all feedback within a week, by May 24th, if possible. Thanks!

@cptvitamin
Copy link

@dsjen no objection to using Bootstrap 4 from me. I'm fairly confident that it can still be used to create accessible interfaces. However, some extra care and attention may be required. It's also important to note that we will not be able to use any feature that doesn't fully conform (or cannot be made to conform) with WCAG 2 AA.

========

In order to accelerate development, and provide a more consistent user
experience for our users, Open edX will adopt Bootstrap 4 to style its web
Copy link

Choose a reason for hiding this comment

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

* integration with build systems
* integration into existing edX pages

Bootstrap is the industry standard framework for desigining web applications. It
Copy link

Choose a reason for hiding this comment

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

Bootstrap is the leading front end framework, but it's definitely not a standard.

* integration into existing edX pages

Bootstrap is the industry standard framework for desigining web applications. It
comes with a comprehensive collection of web components that are designed to be
Copy link

Choose a reason for hiding this comment

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

Should we say "interface components" so as not to be confused with Web Components proper?

within the edX platform:

* Bootstrap 4 has switched to using Sass (previous versions used Less)
* It provides a more flexible grid system that supports all of edX's layouts
Copy link

Choose a reason for hiding this comment

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

Do you mean the introduction of flex box utilities? The grid system hasn't changed much as far as I can tell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of the combination of flexbox plus the improvements they describe here:

https://blog.getbootstrap.com/2015/08/19/bootstrap-4-alpha/

Improved grid system. We’ve added a new grid tier to better target mobile devices and completely overhauled our semantic mixins.

Opt-in flexbox support is here. The future is now—switch a boolean variable and recompile your CSS to take advantage of a flexbox-based grid system and components.

* It provides a more flexible grid system that supports all of edX's layouts
* It uses ems and rems for responsive typography

Another key factor in the switch is the wide availability of Boostrap-based
Copy link

Choose a reason for hiding this comment

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

There is just reactstrap, as far as I know.

with an ever increasing set of components with which to extend the platform.

Finally, a critical benefit to using Bootstrap is that the edX community
does not need to build or work with a proprietary markup scheme. XBlock authors
Copy link

Choose a reason for hiding this comment

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

What do you mean by "markup scheme"?

Choose a reason for hiding this comment

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

I'm guessing this refers to the custom HTML needed, for example, to render custom components in the Pattern Library.


The current recommendation is that the library provide the following partials:

* A partial defining the standard edX fonts, layouts, margins etc
Copy link

Choose a reason for hiding this comment

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

This is not being rendered as a list.

---------------

Google's Material Design is another very successful web framework that was
evaluated. It was ultimately considered to be too opinionated to support the
Copy link

Choose a reason for hiding this comment

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

I don't remember when this conclusion was drawn. And I personally think Material design was conceived for a wide variety of use cases for material design, specifically

Material Components are also kept up to date by Google.

* Options for community
* Frameworks that are opinionated vs. flexible
* Ability to easily build accessible front-ends
* Ease of design-framework integration

Choose a reason for hiding this comment

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

Nit: "design-framework" is confusing upon initial read. Perhaps just, "Ease of integration".

with an ever increasing set of components with which to extend the platform.

Finally, a critical benefit to using Bootstrap is that the edX community
does not need to build or work with a proprietary markup scheme. XBlock authors

Choose a reason for hiding this comment

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

I'm guessing this refers to the custom HTML needed, for example, to render custom components in the Pattern Library.

* Having only a single CSS file that adapts to the desired language
direction makes asset management simpler.

Given this decision, the reference implementation was updated to use `rtlcss`.

Choose a reason for hiding this comment

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

What reference implementation? This is the first mention of an implementation. Can we get a link?

Never mind. I see the mention below. It might be worth calling out the fact that details about the reference implementation are below.


Note: once Bootstrap chooses its own approach, it will be necessary to revisit
this decision. It might be simpler, for example, to switch to use the same
technology for simplicities sake.

Choose a reason for hiding this comment

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

simplicity's sake

introduce a new v3 style, thus leaving all v1 and v2 styles unaffected. This
allows pages to be converted one at a time.

An investigation was performed to see whether Bootstrap components could be used

Choose a reason for hiding this comment

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

What about "global" components like the header and footer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The approach I took in the reference implementation was to conditionalize the header and footer templates with a "use_bootstrap" context parameter. If Bootstrap is being used, the template outputs Bootstrap components. I'll add this explanation.

@azizur
Copy link

azizur commented May 20, 2017

What if I want to use something completely different than Bootstrap?

@OmarIthawi
Copy link
Member

Hey @andy-armstrong, thanks for the update. Since I haven't used postcss-rtl I'll trust the results from the discovery story.

@caesar2164
Copy link

caesar2164 commented May 26, 2017

Thought: Bootstrap stuff could be put inside of a new directory named lms/static/bootstrap.

This would make it easy to tell what is what, and make the conversion easier...

@azizur
Copy link

azizur commented May 26, 2017

@andy-armstrong Correct me if I am wrong, wasn't there something about adapting BEM? How will this work with Bootstrap? Because as far as I know, Bootstrap has it's own selector naming conventions and do not do BEM? Would you then need to have an intermediate step to map CSS classes in Django Templates in SASS to Bootstrap?

@andy-armstrong
Copy link
Contributor Author

Thanks for the feedback, folks. Since these were mostly small changes, I'm hoping this will be the final draft. @dsjen, let's see if we can merge next week.

@andy-armstrong
Copy link
Contributor Author

@azizur I'm not aware of any proposal to adopt BEM. My recommendation is to follow the Bootstrap naming conventions. I wouldn't want to have any name mapping process as that would likely lead to challenges with debugging the resulting CSS, even with source maps.

What if I want to use something completely different than Bootstrap?

For custom extensions to the Open edX code base, you can use whatever technology you like to style your features. However, the core code will all be built upon Bootstrap for ease of development.

@andy-armstrong
Copy link
Contributor Author

@caesar2164 Naming is always hard. I think having a Bootstrap directory is a good idea, so we'll see how that pans out when we start the implementation. My only concern is that there will be shared Sass partials used in both Bootstrap and non-Bootstrap contexts, so I don't know if that will be confusing.

@dsjen
Copy link

dsjen commented Jun 16, 2017

@andy-armstrong -- thank you for all the responses! Yes, I agree about merging next week as this has been open for feedback for quite some time already, and at the core, it looks like we've coalesced around bootstrap.

Copy link

@dsjen dsjen left a comment

Choose a reason for hiding this comment

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

@andy-armstrong -- thank you for putting this out, garnering feedback, and incorporating it. LGTM!

@dsjen dsjen merged commit 84c67da into master Jun 19, 2017
@dsjen dsjen deleted the andya/bootstrap branch June 19, 2017 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants