Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-badgers-struggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

SelectPanel announces loading prop changes
17 changes: 17 additions & 0 deletions packages/react/src/SelectPanel/SelectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,23 @@ function Panel({
}
}, [inputRef, open])

// Manage loading announcements when loadingManagedExternally
useEffect(() => {
if (loadingManagedExternally) {
if (isLoading) {
// Delay the announcement a bit, just in case the loading is quick
loadingDelayTimeoutId.current = safeSetTimeout(() => {
announceLoading()
}, LONG_DELAY_MS)
} else {
// If loading is done, we can clear the loading announcement
if (loadingDelayTimeoutId.current) {
safeClearTimeout(loadingDelayTimeoutId.current)
}
}
}
}, [isLoading, loadingManagedExternally, safeSetTimeout, safeClearTimeout])

// Populate panel with items on first open
useEffect(() => {
if (loadingManagedExternally) return
Expand Down
Loading