Skip to content

[MAR-2699] Render CSS box-shadow for input bar and product cards - #212

Merged
rymorale merged 2 commits into
adobe:mainfrom
rymorale:input-box-drop-shadow
Nov 10, 2026
Merged

rymorale merged 2 commits into
adobe:mainfrom
rymorale:input-box-drop-shadow

Conversation

@rymorale

@rymorale rymorale commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds Android rendering for CSS box-shadow theme tokens. --input-box-shadow now draws on the chat input bar, and --multimodal-card-box-shadow uses the same implementation for product cards.

  • New ConciergeBoxShadow (ui/theme/ConciergeBoxShadow.kt): a typed model (offset, blur, spread, color) created with fromTokens from the map CSSValueConverter.parseBoxShadow already produces. Unset tokens, none and fully transparent colors give null, meaning no shadow.
  • New Modifier.conciergeBoxShadow(shadow, shape):
    • API 28+: draws the shadow with a native Paint + BlurMaskFilter, inflated by spread, translated by offset, and with clipOutPath so it never shows through a translucent background (like CSS). The CSS blur is converted to the Skia mask filter radius so blur matches the web.
    • Below API 28: falls back to Modifier.shadow with the blur radius as elevation. Offset, spread and color are ignored there, since custom shadow colors need API 28+.
    • The drawing is done in a Modifier.Node that caches the paths and paint and rebuilds them only when size, layout direction or density change, so typing in the input bar doesn't rebuild them.
  • Input bar: InputPanelStyle.boxShadow (defaults to null) is applied to the ChatInputPanel surface.
  • Product cards: ExtendedProductCardStyle.shadowElevation/shadowColor are replaced by boxShadow, applied before the card clip so the shadow isn't cut off.
  • Debug demo: the Product Card Demo theme now sets both shadows (0 1px 4px 0 #00000026 for cards, 0 2px 8px 0 #00000026 for the input bar).
  • Docs: Documentation/style-guide.md Shadows section, Key Differences and support status rows updated for both tokens.

Related Issue

MAR-2699

Motivation and Context

--input-box-shadow was parsed into cssLayout.inputBoxShadow but never used, so themes that set it had no input bar shadow on Android. The product card shadow used Modifier.shadow, which only uses the blur radius (as elevation) and color. Android also multiplies the color's alpha by the system's low shadow alpha, so subtle web-style shadows such as #00000026 were nearly invisible. Drawing the shadow directly keeps offset, spread and alpha close to the web.

Behavior change to note: on API 28+, existing themes that set --multimodal-card-box-shadow will now show a more visible card shadow that matches their CSS. Below API 28 the shadow is the default grey elevation shadow, which can look heavier than the CSS value.

How Has This Been Tested?

  • ./gradlew :concierge:testPhoneDebugUnitTest: passed. This includes the new ConciergeBoxShadowTest, which covers token parsing, null/none/transparent handling, negative blur, and the blur radius conversion.
  • ./gradlew :concierge:connectedPhoneDebugAndroidTest with ChatInputPanelTest, ExtendedProductCardTest, ProductCarouselTest and ConciergeStylesTest on an API 31 emulator: 123/123 passed. The new pixel tests check that the shadow renders, that a vertical offset puts the shadow below and not above, that none gives no shadow, and that the style getters map both tokens.
  • make lint: passed.
  • Manual check of the debug Product Card Demo screen on API 31 (custom draw) and API 27 (elevation fallback). Card and input bar shadows render, and nothing is clipped in the carousel.

Screenshots (if appropriate):

Product Card Demo, API 27 (elevation fallback) vs API 31 (CSS box-shadow draw):
product-card-demo-shadows-comparison-full

Input bar:
product-card-demo-shadows-comparison-input-bar

Product card edge:
product-card-demo-shadows-comparison-card-edge

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Consume the --input-box-shadow theme token, which was parsed but never
rendered, and move --multimodal-card-box-shadow onto the same
implementation.

- Add ConciergeBoxShadow (offset, blur, spread, color) and a
  Modifier.conciergeBoxShadow that draws the shadow itself on API 28+
  (BlurMaskFilter + clipOutPath) so offset, spread and low-alpha colors
  match the web. Modifier.shadow scaled the color's alpha down by the
  system shadow alpha, which made subtle shadows invisible.
- Below API 28, fall back to Modifier.shadow elevation. Offset, spread
  and color are ignored there.
- Cache the shadow path and paint in a Modifier.Node so typing in the
  input bar doesn't rebuild them on every recomposition.
- Replace ExtendedProductCardStyle.shadowElevation/shadowColor with
  boxShadow and apply it to the input panel and product cards.
- Add shadows to the debug Product Card Demo theme.
- Add unit and instrumented tests, and update the style guide Shadows
  section and support status.
@rymorale
rymorale requested a review from cdhoffmann November 10, 2026 19:08
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.39130% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ng/mobile/concierge/ui/theme/ConciergeBoxShadow.kt 94.66% 0 Missing and 4 partials ⚠️
...le/concierge/ui/components/card/ProductCardDemo.kt 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@cdhoffmann cdhoffmann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

--multimodal-card-box-shadow is only applied to productDetail cards. The default actionButton ProductCard still uses a hardcoded 1dp elevation (ConciergeStyles.productCardStyle), while iOS applies the token to both card styles (ChatMessageView.actionButtonCarouselCard / actionButtonProductCard).

Can ProductCard use the new modifier too?

Card(
    modifier = modifier.conciergeBoxShadow(ConciergeBoxShadow.fromTokens(layout?.multimodalCardBoxShadow), style.shape),
    elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
    ...
)

@rymorale

Copy link
Copy Markdown
Contributor Author

good callout, i'll get it applied there as well

@rymorale

rymorale commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

for ProductCard, I've left the default at 1dp so there is no visual regression for themes which don't set the --multimodal-card-box-shadow config. product card shadow:
productcard-actionbutton-configured-shadow

Address review feedback: --multimodal-card-box-shadow was only applied to
productDetail cards (ExtendedProductCard) while the default actionButton
ProductCard kept a hardcoded 1dp elevation. iOS applies the token to both
card styles, so ProductCard now uses the same conciergeBoxShadow modifier.

- Add boxShadow to ConciergeStyles.ProductCardStyle, resolved from the
  multimodalCardBoxShadow token via ConciergeBoxShadow.fromTokens.
- Apply conciergeBoxShadow in ProductCard; keep the 1dp elevation only as a
  fallback when no shadow token is configured (no change to default appearance).
- Add parity instrumented tests: shadow renders beyond the card bounds when
  the token is set, and no custom shadow when it is not.
- Add Robolectric SDK-gated unit tests and an instrumented recomposition test
  covering the below-API-28 elevation fallback and the draw-node update path
  flagged by Codecov.
- Update the style guide to note the card shadow applies to both the
  actionButton ProductCard and the productDetail ExtendedProductCard.
@rymorale
rymorale merged commit 13dbfa8 into adobe:main Nov 10, 2026
11 checks passed
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.

2 participants