Skip to content

fix(emotion,ui-link): fall back to defaultProps when a prop is explicitly undefined - #2796

Open
matyasf wants to merge 1 commit into
masterfrom
fix/instui-5252-undefined-default-props
Open

matyasf wants to merge 1 commit into
masterfrom
fix/instui-5252-undefined-default-props

Conversation

@matyasf

@matyasf matyasf commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • withStyle/withStyleNew no longer let an explicit undefined prop overwrite its default when computing styles, so <View borderColor={undefined} /> looks the same in React 18 and 19
  • Remove the iconPlacement = 'start' workaround from Link v1 and v2 styles.ts, which only existed because of this

Test Plan

  • Render the snippet from the ticket in the regression-test app (React 19.3.0) and compare the border color with React 18
  • Check <Link renderIcon={...} iconPlacement={undefined}> puts the icon before the text
  • Test this code in React 18 and 19, the border should be grey:
<View
  display="inline-block"
  borderWidth="large"
  borderColor={undefined}>
test 123
</View>

Fixes INSTUI-5252

🤖 Generated with Claude Code

@matyasf matyasf self-assigned this Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2796/

Built to branch gh-pages at 2026-11-13 12:39 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

github-actions Bot pushed a commit that referenced this pull request Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Visual regression report

Cypress suite: ✅ Passing

Visual diff: ⚠️ Changes detected.

Status Count
Unchanged 108
Changed 3
New 0
Removed 0

Accessibility (axe): ✅ No violations.

📊 View full report — click a screenshot's ⚠ badge to see each violation boxed on the image, with the offending element named and contrast failures shown as color swatches.

Diff images (3)

view-canvas.png — 2204 pixels differ

view-dark.png — 2288 pixels differ

view-light.png — 281 pixels differ

Baselines come from the visual-baselines branch. They refresh on every merge to master. The Cypress suite line covers the a11y and console-error assertions — a ❌ there means the suite found real issues even if the visual diff is clean.

@matyasf
matyasf requested review from HerrTopi and balzss November 13, 2026 11:56
…itly undefined

React 19 does not resolve defaultProps on the forwardRef wrapper that withStyle and
withStyleNew create, and the wrapper's `{ ...defaultProps, ...props }` merge let an
explicit `undefined` overwrite the default. generateStyle therefore saw `undefined`
while the wrapped class still got its default, so `<View borderColor={undefined} />`
rendered without a border color.

The Link `iconPlacement` default in styles.ts only existed to paper over this and is
removed.

Co-Authored-By: Claude <noreply@anthropic.com>
@matyasf
matyasf force-pushed the fix/instui-5252-undefined-default-props branch from dc085e0 to 86017ba Compare November 13, 2026 12:36
github-actions Bot pushed a commit that referenced this pull request Nov 13, 2026

This branch has not been deployed

No deployments
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.

1 participant