Repository navigation
Conversation
… actually disable dots onChange called onPageChange unconditionally even though it's typed optional, throwing when a consumer omits it. disabled only dimmed the dot's color via $disabled; the native radio input never got the disabled attribute, so a "disabled" PageControl was still fully clickable and kept firing onPageChange.
zigzagdev
requested review from
DianaSuvorova,
dyesin,
hualf1995 and
lijim
as code owners
October 21, 2026 01:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
PageControlhad two crash and functional break level issues living in the same handful of lines.First, clicking a dot called onPageChange unconditionally even though the prop is typed optional, so any consumer that omits it (which the type explicitly allows) gets a runtime
TypeErroron the very first click.Second, setting disabled only dimmed the dot's background color through a style prop; the underlying native radio input never received the disabled attribute, so a "disabled" PageControl stayed fully clickable and kept firing
onPageChange, defeating the entire point of the prop.Both bugs sit in the same render path, so fixing them together avoids touching this file twice.
Description
Changed the dot's onChange handler to call onPageChange with optional chaining so a missing handler is a no-op instead of a crash.
Added
disabled={disabled}to the underlying radio input so the native disabled attribute is actually applied, which blocks both pointer and keyboard interaction and theonChangeit was firing.Added three regression tests covering the crash case, the disabled case, and the normal enabled click case, since
PageControlpreviously had no test coverage at all.Scope
Patch (Bug Fix)