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

feat(framework): Limited support for campact size on IE #2230

Merged
merged 2 commits into from
Sep 23, 2020

Conversation

vladitasev
Copy link
Contributor

@vladitasev vladitasev commented Sep 21, 2020

The goal of this change is to provide limited support for compact mode to IE11.

Background: Compact mode is entirely dynamic. The way to achieve it is with CSS variables, defined for compact mode markers (attribute or class). Example:

[data-ui5-compact-size],
.ui5-content-density-compact,
.sapUiSizeCompact {
	--_ui5_button_base_height: 1.625rem;
...................................
}

The IE CSS Vars ponyfill on the other hand can only handle variables on :root and :host since it needs to generate static CSS declarations.

IE11 limitation:

  • Compact mode only works for the page as a whole - you must set the data-ui5-compact-size attribute, the ui5-content-density-compact class or the sapUiSizeCompact class on the body element only.
  • Compact mode is not dynamic - if you change cozy/compact at runtime, nothing will happen out of the box.

How does it work: The CSS Vars Ponyfill has the variables feature that lets you override some of the variables before the calculations take place. If the body has compact size set, the framework reads all style[data-ui5-theme-properties] tags' content and detects the compact size variables based on the [data-ui5-compact-size] rule, which is the official one and is mandatory. Then it passes the values of these variables to the ponyfill which effectively looks like this:

window.CSSVarsPonyfill.cssVars({
	rootElement: document.head,
	variables: {
               "_ui5_button_base_height": "1.625rem",
              ....................................
        },
	silent: true,
});

Additionally, a bug on IE11 was fixed in UI5Element.js. On IE11 the lifecycle is a bit different and it's possible to access the listeners set before it has been defined. Therefore it's moved up in the constructor before properties upgrade.

closes: #2211

@vladitasev vladitasev changed the title WIP feat(framework): Limited support for campact size on IE feat(framework): Limited support for campact size on IE Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Component 'sap-ui-content-density' behavior is not correct in IE.
4 participants