Skip to content

revert: restore the previous toast UI - #337

Merged
huhuanming merged 1 commit into
mainfrom
codex/toast-ui-rollback
Nov 26, 2026
Merged

huhuanming merged 1 commit into
mainfrom
codex/toast-ui-rollback

Conversation

@huhuanming

@huhuanming huhuanming commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Release coordination

The companion App change restores the previous toast styling and loading behavior. Update the App's overlay dependency and lockfiles to the version published from this PR before merging the App change.

Test plan

  • Overlay typecheck, lint, build, and package archive.
  • Overlay Jest suite, 162 tests passed.
  • Chromium toast and page isolation regression suites, 14 tests passed.
  • Android overlay compilation and Robolectric suite, 40 tests passed.
  • iOS 26.0 simulator smoke test for card radius, stack order, timeout, and programmatic dismissal. Existing window manager suite also passed.
  • Full App verification on iOS and Android with the published package.

Devin Review

Companion App PR: OneKeyHQ/app-monorepo#14812

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex review

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex security review

@sidmorizon

Copy link
Copy Markdown
Contributor

Cursor review failed.

Remote error: cursor_permission_denied: HTTP 403 Forbidden: Cloud Agent is not available for free users. Please upgrade to Pro.

@cursor

cursor Bot commented Nov 26, 2026

Copy link
Copy Markdown

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T09:44:54.235571Z 9b1ee5a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sidmorizon

Copy link
Copy Markdown
Contributor

Devin Cloud review ↗

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 9b1ee5a449

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 5 potential issues.

3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@sidmorizon

Copy link
Copy Markdown
Contributor

@huhuanming
huhuanming merged commit e11286f into main Nov 26, 2026
16 checks passed
@huhuanming
huhuanming deleted the codex/toast-ui-rollback branch November 26, 2026 09:52
li.setAttribute('data-mounted', String(node.mounted));
li.setAttribute('data-removed', String(node.removed));
li.setAttribute('data-visible', String(visible));
li.setAttribute('data-visible', String(index + 1 <= VISIBLE_TOASTS));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Keep hidden web toast controls out of keyboard navigation]

With four toasts, the fourth card is transparent but its buttons and links can still receive focus. The same happens to actions on a collapsed back card because opacity hides the body without disabling its controls. A keyboard user can activate an action they cannot see.

Please restore inert handling for hidden or leaving cards and for the body of collapsed back cards, then restore access when a card becomes visible or expands.

(absAmount >= SWIPE_DISTANCE ||
(absAmount >= SWIPE_FLICK_DISTANCE &&
velocity >= SWIPE_FLICK_VELOCITY));
Math.abs(amount) >= SWIPE_THRESHOLD || velocity > SWIPE_VELOCITY;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Prevent failed drags from activating notifications]

On Web, press a top notification with a mouse and drag downward within the same row. The swipe is rejected, but the row still receives the resulting click and calls onPress. On Android, a sideways drag that stays inside a clickable notification similarly stays on the card's click path because the slot only intercepts vertical movement.

Please cancel notification tap activation once movement exceeds the gesture slop, while keeping ordinary taps and the restored vertical swipe behavior.

if !buttons.isEmpty {
if hasBlock { y += ToastMetrics.messageTextGap }
y += self.layoutActions(
buttons, x: x, y: y, width: columnWidth,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Keep message actions reachable under the content height cap]

With a 24-point title, one short action and contentMaxHeight: 36, the iOS action starts below the clipped content box. The title, text gap and 12-point action inset consume the full cap before the button begins. The previous layout had a measured inline fallback for this case.

Please keep the lower row for normal cards and use the fitting inline layout when the height cap would hide the action.

documentDirection = getDocumentDirection();
reconcilePositions();
update();
if ((config.topObstruction ?? 0) > 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Remeasure web cards when their layout constraints change]

Show two toasts with wrapping text on a wide viewport, narrow the viewport, then expand the stack. Resize never updates initialHeight or the height index, so each card and its neighbors still use the wide layout's heights. A height-cap change or a move to a differently sized group can leave the same stale measurements, clipping content or misplacing an adjacent card.

Please apply the new width and cap, then measure affected cards in their destination group before applying expanded heights and offsets.

return;
}
if (reduceMotion()) {
node.unmountTimer = setTimeout(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Skip exit cleanup once a web toast has been replaced]

If a timeout's onDismiss calls show with the same ID, the store synchronously mounts a replacement while deleteToast is still running. The old node then schedules this timeout. When it fires, unmount removes the replacement's height entry by ID. The replacement stays visible, but another expanded card can collapse onto its position.

Please restore the nodes.get(node.id) === node check after reporting dismiss and before scheduling the timer.


val available = region.width().toDouble()
val contentWidth = toastContentWidth(region.width() / density, config.contentWidth)
val contentWidth = config.contentWidth

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Clamp native toast widths to the current safe area]

If a caller supplies contentWidth: 500 and the window narrows to 320 dp or pt, both native presenters still build a 532-unit outer card and center it. A short right-aligned action can end up entirely offscreen. Window resize and the next config update can also arrive separately.

Please clamp the requested content width to the current safe-area width minus card padding and the intended side insets before measuring the card on both platforms.

);
const reduceMotion = () =>
config.respectReducedMotion !== false && motionPreference?.matches;
const positionOf = (spec: IOverlayToastSpec): IOverlayToastPosition =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Merge web toast groups that share a narrow lane]

At 390 px, show one top-left toast and one top-center toast. The narrow CSS gives both front cards the same bounds, but positionOf puts them in separate groups. One notification and its action can be completely covered by the other.

Please retain a common group for same-edge positions at the narrow breakpoint, including when the viewport crosses it while toasts are visible.

[data-rich-colors="true"] [data-onekey-toast][data-type="info"],[data-rich-colors="true"] [data-onekey-toast][data-type="info"] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}
[data-rich-colors="true"] [data-onekey-toast][data-type="warning"],[data-rich-colors="true"] [data-onekey-toast][data-type="warning"] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}
[data-rich-colors="true"] [data-onekey-toast][data-type="error"],[data-rich-colors="true"] [data-onekey-toast][data-type="error"] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}
@media (prefers-reduced-motion){[data-onekey-toast],[data-onekey-toast]>*{transition:none!important;animation:none!important}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Apply reduced motion consistently to web swipe exits]

With system Reduce Motion enabled, a successful swipe clears the drag transform and sets data-swipe-out. The media rule disables the keyframes, and the remaining exit rules only fade cards with data-swipe-out="false". The front card snaps back into view until the 200 ms unmount. The same media rule disables card animation even for callers that set respectReducedMotion: false.

Please scope the reduced-motion styles to the resolved toaster setting and set swipe-out cards to hidden in that mode.

if (
node.swipePointerId === undefined &&
canSwipeNode(node) &&
!selectableMousePress &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Preserve mouse selection in selectable toast text]

Mouse-down on a selectable text run now claims the toast's swipe pointer. Drag upward across the lines of a top toast and the renderer can capture the pointer and dismiss the card after 20 px. That prevents the selection the caller explicitly enabled.

Please restore the mouse-only exclusion for swipe starts in [data-okt-selectable] while keeping touch swipes available.

if shift != obstructionShift {
obstructionShift = shift
let apply = { self.cards.transform = CGAffineTransform(translationX: 0, y: shift) }
let apply = { self.stage.transform = CGAffineTransform(translationX: 0, y: shift) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [Verify obstruction placement after the iOS toast window reopens]

At NativeOverlayToasterView.swift:315, the obstruction now transforms stage itself. Window release leaves that transform and obstructionShift set. The next ensureWindow assigns stage.frame while the transform is set, and an unchanged obstruction skips the shift update. I could not confirm the resulting geometry in UIKit.

A simulator check that shows a toast below a fixed obstruction, closes the final toast completely, then shows another with the same config would settle this. Compare the two settled card frames. If the second card lands at a different offset, reset the stage transform and cached shift together on window release. Please reply in this thread with the result.

li.setAttribute('data-mounted', String(node.mounted));
li.setAttribute('data-removed', String(node.removed));
li.setAttribute('data-visible', String(visible));
li.setAttribute('data-visible', String(index + 1 <= VISIBLE_TOASTS));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2: Invisible toast actions remain keyboard-active

Severity: non-severe

When a web stack hides a toast or collapses its body, applyGroup leaves the hidden controls keyboard-focusable. Opacity and pointer-event rules do not stop Tab or Enter, so users can activate unseen actions.

Delivered after this pull request was merged.

(absAmount >= SWIPE_FLICK_DISTANCE &&
velocity >= SWIPE_FLICK_VELOCITY));
Math.abs(amount) >= SWIPE_THRESHOLD || velocity > SWIPE_VELOCITY;
clearPress(pointerId, press);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2: Notification drags open the notification

Severity: non-severe

After a mouse drag stays inside a web notification without starting a swipe, onGlobalPointerEnd leaves the browser click unblocked. The row reports a press even though the user dragged rather than clicked.

Delivered after this pull request was merged.

Comment on lines +735 to +737
if ((config.topObstruction ?? 0) > 0) {
update();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2: Resized toast stacks clip their contents

Severity: non-severe

When a narrow web window wraps toast text onto more lines, onResize keeps the old card heights. Expanded cards reuse those heights for their boxes and spacing, so content can be clipped or covered by another card.

Delivered after this pull request was merged.

Comment on lines +151 to +152
const positionOf = (spec: IOverlayToastSpec): IOverlayToastPosition =>
spec.position ?? config.position ?? DEFAULT_POSITION;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2: Mobile toast groups cover each other

Severity: non-severe

When web toasts use different horizontal anchors on the same edge, positionOf gives them separate stacks. On narrow screens those stacks share one position, so opening the stack still leaves one toast covering the other.

Delivered after this pull request was merged.

if shift != obstructionShift {
obstructionShift = shift
let apply = { self.cards.transform = CGAffineTransform(translationX: 0, y: shift) }
let apply = { self.stage.transform = CGAffineTransform(translationX: 0, y: shift) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2: Reopened toasts lose obstruction clearance

Severity: non-severe

After the iOS toaster empties beneath an obstruction, ensureWindow resets the stage frame but leaves the cached shift intact. With the same obstruction, the next toast appears at the normal top anchor and overlaps it.

Delivered after this pull request was merged.

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.

4 participants