Skip to content

fix(core): clear a View to transparent for an explicit zero alpha - #11153

Merged
chrisgervang merged 1 commit into
masterfrom
chr/view-clear-zero-alpha
Nov 17, 2026
Merged

chrisgervang merged 1 commit into
masterfrom
chr/view-clear-zero-alpha

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #11149
Introduced by #9650

Background

A View's clearColor uses clearColor[3] || 255 in the default 0–255 mode, so an explicit zero alpha clears opaque. I added || 255 in #9650 to fill an omitted alpha, so a zero alpha turning opaque is a bug. A View can't clear to transparent unless the app opts into normalizedColors. Noodles.gl hit this with [0, 0, 0, 0] (joby-aviation/noodles.gl#892).

Change List

  • LayersPass: fill only an omitted clear alpha, in both color modes
  • Unit tests: zero byte alpha is transparent, omitted is opaque
  • Documentation: View clearColor alpha
  • Upgrade guide: zero clear alpha is now transparent

Verified with the layers-pass headless tests, node tests and yarn lint. The zero-alpha assertion fails on master.

🤖 Generated with Claude Code


Note

Low Risk
Low risk bug fix correcting alpha fallback evaluation for View viewport clears.

Overview
Fixes an issue in LayersPass where a View's clearColor with an explicit zero alpha (such as [0, 0, 0, 0]) cleared to opaque when using default 0–255 byte colors.

Alpha resolution now uses nullish coalescing (??) instead of logical OR (||), ensuring an explicit zero alpha clears to transparent while omitted alpha defaults to opaque. Documentation, v10 upgrade notes, and unit tests have been updated to reflect this behavior.

Reviewed by Cursor Bugbot for commit 07c93ce. Bugbot is set up for automated code reviews on this repo. Configure here.

clearColor[3] || 255 filled an omitted alpha but also turned an
explicit 0 into opaque in the default 0-255 mode. Fill only an omitted
alpha, matching the normalizedColors branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Fixes View.clearColor so explicit zero alpha stays transparent in byte-color mode.

  • View clears keep an explicit zero alpha transparent.

Reviews (1) · Last reviewed commit: "fix(core): clear a View to transparent f..." · Reviewed by Greptile

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 83.574% (-0.001%) from 83.575% — chr/view-clear-zero-alpha into master

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the clear-alpha change and regression coverage. Explicit zero stays transparent, omitted alpha remains opaque, and the picking guard is unchanged. The upgrade guide documents the byte-mode behavior change.

@chrisgervang
chrisgervang added this pull request to the merge queue Nov 17, 2026
Merged via the queue into master with commit f842929 Nov 17, 2026
9 checks passed
@chrisgervang
chrisgervang deleted the chr/view-clear-zero-alpha branch November 17, 2026 01:06
@ibgreen ibgreen mentioned this pull request Nov 17, 2026
22 of 52 tasks
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.

3 participants