Repository navigation
revert: restore the previous toast UI - #337
Conversation
|
@codex review |
|
@codex security review |
|
Cursor review failed. Remote error: |
|
Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
Devin Review found 5 potential issues.
3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| 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)); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 => |
There was a problem hiding this comment.
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}} |
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
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) } |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
🟡 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); |
There was a problem hiding this comment.
🟡 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.
| if ((config.topObstruction ?? 0) > 0) { | ||
| update(); | ||
| } |
There was a problem hiding this comment.
🟡 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.
| const positionOf = (spec: IOverlayToastSpec): IOverlayToastPosition => | ||
| spec.position ?? config.position ?? DEFAULT_POSITION; |
There was a problem hiding this comment.
🟡 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) } |
There was a problem hiding this comment.
🟡 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.
Summary
bc8038ca4, published as@onekeyfe/react-native-native-overlay@6.8.0-27.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
Companion App PR: OneKeyHQ/app-monorepo#14812