Răsfoiți Sursa

fix(app): keep session options button active while sharing

Avoid a one-frame active-state flicker when transitioning from the options dropdown to the share popover by treating the pending-share state as active until the popover opens.
David Hill 1 lună în urmă
părinte
comite
d2747d70d6
1 a modificat fișierele cu 8 adăugiri și 2 ștergeri
  1. 8 2
      packages/app/src/pages/session/message-timeline.tsx

+ 8 - 2
packages/app/src/pages/session/message-timeline.tsx

@@ -744,7 +744,11 @@ export function MessageTimeline(props: {
                             icon="dot-grid"
                             variant="ghost"
                             class="size-6 rounded-md data-[expanded]:bg-surface-base-active"
+                            classList={{
+                              "bg-surface-base-active": share.open || title.pendingShare,
+                            }}
                             aria-label={language.t("common.moreOptions")}
+                            aria-expanded={title.menuOpen || share.open || title.pendingShare}
                             ref={(el: HTMLButtonElement) => {
                               more = el
                             }}
@@ -761,8 +765,10 @@ export function MessageTimeline(props: {
                                 }
                                 if (title.pendingShare) {
                                   event.preventDefault()
-                                  setTitle("pendingShare", false)
-                                  requestAnimationFrame(() => setShare({ open: true, dismiss: null }))
+                                  requestAnimationFrame(() => {
+                                    setShare({ open: true, dismiss: null })
+                                    setTitle("pendingShare", false)
+                                  })
                                 }
                               }}
                             >