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

Add forced border-box to Adaptive Cards #4084

Merged
merged 6 commits into from
Dec 20, 2021
Merged

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Nov 5, 2021

Fixes #4075.

Changelog Entry

Fixed

  • Fixes #4075. Added box-sizing: border-box to all descendants under Adaptive Cards, by @compulim, in PR #4084

Description

Adaptive Cards team assume the host is running in "forced border-box" mode, which means all DOM descendants has box-sizing: border-box rule set. Adaptive Cards Designer applied this CSS rule:

#designerRootHost * {
  box-sizing: border-box;
}

However, Web Chat is a UI component and we cannot assume our hosting environment has specific non-default values set. The default value in CSS is a non-inheritable box-sizing: content-box.

Thus, we are adding "forced border-box" mode only for Adaptive Card:

.webchat__adaptive-card-renderer * {
  box-sizing: border-box;
}

As the CSS rule is not trivial to unset and deeply polluting, this work will restrict us from extending Adaptive Card. However, we have no plans to extend Adaptive Cards.

In case there is a requirement to extend Adaptive Cards in the future, we must bring this issue up to Adaptive Cards team again, and ask them to fix the root cause before we or our web devs could implement any Adaptive Card extensions.

Design

After talking to David from Adaptive Cards team, he asked us to put the Adaptive Card container in "forced border-box" mode.

Specific Changes

  • Add .webchat__adaptive-card-renderer * { box-sizing: border-box; } rule
  • Also fixed our Docker watch script to watch for bundle build under /packages/bundle/dist, where webchat*.js is located
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@compulim compulim merged commit 78dc927 into microsoft:main Dec 20, 2021
@compulim compulim deleted the fix-4075 branch December 20, 2021 03:36
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.

Using word-wrap in Adaptive Cards ActionSet and markdown list
2 participants