fix: tighten toast typing and restore focus visibility#33591
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the toast component by improving its type safety and accessibility. It exports essential toast types for broader use, refactors internal logic to leverage type-safe mappings for visual elements, and addresses a critical accessibility concern by restoring keyboard focus visibility. These changes make the toast component more robust, easier to maintain, and more compliant with accessibility standards. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the toast component to improve type safety and maintainability, and also fixes an accessibility issue with focus visibility. The changes include exporting types, replacing conditional logic with maps, removing an unsafe type cast, and adding a related regression test. I have one suggestion for a minor code simplification.
There was a problem hiding this comment.
Pull request overview
This PR improves the toast primitive’s public typing contract and restores keyboard focus visibility for toast roots, while adding a regression assertion in the toast host test suite.
Changes:
- Exports
ToastType,ToastAddOptions,ToastUpdateOptions, and refinesToastPromiseOptionsto be part of the public API. - Replaces string-branching for tone rendering with typed maps for icons and gradients, and normalizes
toast.promiseoptions instead of using an unsafe cast. - Restores focus outline visibility on the toast root and adds a regression assertion for it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
web/app/components/base/ui/toast/index.tsx |
Exports toast option types, adds typed tone maps, removes unsafe toast.promise cast, and removes outline-none from the toast root. |
web/app/components/base/ui/toast/__tests__/index.spec.tsx |
Adds an assertion that the toast dialog root is not rendered with outline-none. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR strengthens the toast primitive’s public typing surface while improving runtime rendering safety and restoring visible keyboard focus on the toast root for accessibility.
Changes:
- Export
ToastType,ToastAddOptions,ToastUpdateOptions, andToastPromiseOptionsas public types. - Replace string-branching tone rendering with an exhaustive
ToastType→ style map and a safe runtime normalizer (getToastType). - Restore focus visibility by removing
outline-nonefrom the toast root and add a regression assertion for it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| web/app/components/base/ui/toast/index.tsx | Exports toast types/options, introduces typed tone style map + normalizer, removes unsafe toast.promise cast, and restores focus outline behavior on the toast root. |
| web/app/components/base/ui/toast/tests/index.spec.tsx | Adds a regression assertion ensuring the toast root is not rendered with outline-none. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR improves the base/ui/toast primitive by making its public typings stricter, removing unsafe casts around promise toasts, and restoring keyboard focus visibility on the toast root.
Changes:
- Export
ToastTypeand toast option types as part of the toast primitive’s public contract. - Replace tone-based branching with an exhaustive typed map for icon + gradient class selection.
- Restore focus visibility on the toast root and add a regression assertion in the toast host test; configure the app-level host toast stack limit.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| web/app/layout.tsx | Configures the global ToastHost with a stack limit to cap visible toasts. |
| web/app/components/base/ui/toast/index.tsx | Exports public toast types, removes the unsafe promise cast, and refactors tone styling + focus behavior. |
| web/app/components/base/ui/toast/tests/index.spec.tsx | Adds a regression check that the toast root is no longer outline-none. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Updates the app’s toast system configuration and refactors toast tone styling to be more type-safe and centralized, while tightening toast stack behavior in the main layout.
Changes:
- Add a toast stack
limitin the root app layout (limit={3}). - Refactor toast tone handling (icon + gradient) into a single
TOAST_TONE_STYLESmap with exported public types. - Adjust toast root styling and update the toast UI test assertions accordingly.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
web/app/layout.tsx |
Configures the global ToastHost with a visible stack limit. |
web/app/components/base/ui/toast/index.tsx |
Centralizes tone styles, tightens toast type handling, and tweaks toast root styling. |
web/app/components/base/ui/toast/__tests__/index.spec.tsx |
Updates regression tests to match the toast root class change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
toast.promisecast by normalizing the promise lifecycle options before delegating to Base UIFixes #32811
Checklist
pnpm --dir web exec eslint app/components/base/ui/toast/index.tsx app/components/base/ui/toast/__tests__/index.spec.tsx,pnpm --dir web type-check,pnpm --dir web type-check:tsgo, andpnpm --dir web test --run app/components/base/ui/toast/__tests__/index.spec.tsx.